Table of Contents

Struct Capsule

Namespace
Box3D
Assembly
Box3D.NET.dll

A capsule: a sphere swept along a segment.

public readonly record struct Capsule : IEquatable<Capsule>

Implements

Inherited Members

Examples

// An upright capsule roughly the size of a person: 1.8m tall, 0.3m radius.
var body = Capsule.Upright(height: 1.8f, radius: 0.3f);
character.AddCapsule(body);

Remarks

Capsules are the usual choice for characters, because they slide over small steps and ledges instead of catching on them the way a box does.

Constructors

Capsule(Vector3, Vector3, float)

Initializes a new instance of the Box3D.Capsule struct.

Properties

End

Gets the centre of the second hemisphere.

Radius

Gets the radius.

SegmentLength

Gets the distance between the two hemisphere centres.

Start

Gets the centre of the first hemisphere.

Methods

Upright(float, float)

Creates a capsule standing along the y axis, centred on the body origin.