Capsule
Class representing a capsule in 3D space. A capsule is essentially a cylinder with hemispherical caps at both ends. It can be thought of as a swept sphere, where a sphere is moved along a line segment. Capsules are often used as bounding volumes (next to AABBs and bounding spheres).
Methods
Capsule(const Vector3& start, const Vector3& end, f32 radius)
Constructor to create new capsule
| start | start vector | Vector3(0,0,0) |
| end | end vector | Vector3(0,1,0) |
| radius | capsule's radius | 1.0f |
Capsule& set(const Vector3& start, const Vector3& end, f32 radius)
Sets the capsule components to the given values
| start | start vector | |
| end | end vector | |
| radius | capsule's radius |
Capsule clone() const
Returns a new capsule with copied values from this instance
Capsule& copy(const Capsule& capsule)
Copies the values of the given capsule to this instance
| capsule | capsule to copy from |
Vector3& getCenter(Vector3& target) const
Returns the center point of this capsule
| target | target vector that is used to store the method's result |
Capsule& translate(const Vector3& v)
Adds the given offset to this capsule, effectively moving it in 3D space
| v | offset that should be used to translate the capsule |
bool intersectsBox(const Box3& box) const
Returns true if the given bounding box intersects with this capsule
| box | bounding box to test |
bool equals(const Capsule& capsule) const
Returns true if this capsule is equal with the given one
| capsule | capsule to compare with this one |
bool operator==(const Capsule& capsule) const
Checks if this capsule equals another
| capsule | capsule to compare with |
bool operator!=(const Capsule& capsule) const
Checks if this capsule does not equal another
| capsule | capsule to compare with |
Properties
| enabled | bool | Active/inactive |
| end | Vector3 | end vector |
| id | u32 | Unique identifier |
| isCapsule | bool | Read-only tag |
| name | string | Optional display name |
| radius | f32 | capsule's radius |
| start | Vector3 | start vector |
| uuid | string | UUID string |
| version | u32 | Bumps on change |