Capsuleclass

A capsule object, defined by 2 points and a radius. A capsule is a cylinder with round ends (inset half spheres on each end).

objectCapsule
Namespace
global
Assembly
Sandbox.System
Declaration
public sealed struct Capsule

Constructors1

Showing 1 constructors

Methods3

Showing 3 methods

public bool Contains(Vector3 point)PUBLIC

Determines if the capsule contains the specified point.

ParameterTypeDescription
pointVector3
Returns:bool

public static Capsule FromHeightAndRadius(float height, float radius)PUBLICSTATIC

Creates a capsule where Point A is radius units above the ground and Point B is height minus radius units above the ground.

ParameterTypeDescription
heightfloat
radiusfloat
Returns:Capsule

public float GetEdgeDistance(Vector3 localPos)PUBLIC

Calculates the distance from a given point to the edge of the capsule.

ParameterTypeDescription
localPosVector3Position in the same coordinate space as the capsule
Returns:float

Properties4

Showing 4 properties

public BBox Capsule.Bounds { get; set; }PUBLICGETSET

Gets the Bounding Box of the capsule.

Returns:BBox

public Vector3 Capsule.RandomPointInside { get; set; }PUBLICGETSET

Returns a random point within this capsule.

Returns:Vector3

public Vector3 Capsule.RandomPointOnEdge { get; set; }PUBLICGETSET

Returns a random point on the edge of this capsule.

Returns:Vector3

public float Capsule.Volume { get; set; }PUBLICGETSET

Gets the volume of the capsule in cubic units.

Returns:float

On this page