s&box docs

public sealed struct Capsule

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

Broader workflow and conceptual references connected to this API.

Constructors

Showing 1 constructors

Methods

Showing 3 methods

public bool Contains(Vector3 point)

Determines if the capsule contains the specified point.

public static Capsule FromHeightAndRadius(float height, float radius)

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

public float GetEdgeDistance(Vector3 localPos)

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

Parameters

  • localPos: Position in the same coordinate space as the capsule

Properties

Showing 4 properties

public BBox Capsule.Bounds { get; set; }

Gets the Bounding Box of the capsule.

public Vector3 Capsule.RandomPointInside { get; set; }

Returns a random point within this capsule.

public Vector3 Capsule.RandomPointOnEdge { get; set; }

Returns a random point on the edge of this capsule.

public float Capsule.Volume { get; set; }

Gets the volume of the capsule in cubic units.

Metadata

FieldValue
Namespaceglobal
Typeclass
AssemblySandbox.System
Doc IDT:Capsule

On this page