#include <CapsuleCollider.hpp>
|
| | CapsuleCollider ()=default |
| | Default constructor.
|
| | CapsuleCollider (float hHeight, float r) |
| | Construct with half-height and radius.
|
| | CapsuleCollider (float hHeight, float r, const glm::vec3 &localOffset) |
| | Construct with half-height, radius and offset.
|
| float | GetTotalHeight () const |
| | Get total height of the capsule.
|
| float | GetCylinderHeight () const |
| | Get height of just the cylindrical part.
|
| float | GetDiameter () const |
| | Get diameter of the capsule.
|
| void | SetHeight (float capsuleHeight) |
| | Set height (distributes between cylinder and caps).
|
| bool | IsValid () const |
| | Check if collider is valid.
|
| bool | IsSphere () const |
| | Check if this capsule degenerates to a sphere.
|
|
| float | halfHeight = 0.5f |
| | Half height of the cylindrical part (distance from center to cap start).
|
| float | radius = 0.25f |
| | Radius of the capsule (both cylinder and hemisphere caps).
|
| glm::vec3 | offset {0.0f, 0.0f, 0.0f} |
| | Local offset from entity transform (center of capsule).
|
◆ CapsuleCollider() [1/3]
| Physics::Component::CapsuleCollider::CapsuleCollider |
( |
| ) |
|
|
default |
◆ CapsuleCollider() [2/3]
| Physics::Component::CapsuleCollider::CapsuleCollider |
( |
float | hHeight, |
|
|
float | r ) |
|
inline |
Construct with half-height and radius.
- Parameters
-
| hHeight | Half height of the cylindrical part |
| r | Radius of the capsule |
◆ CapsuleCollider() [3/3]
| Physics::Component::CapsuleCollider::CapsuleCollider |
( |
float | hHeight, |
|
|
float | r, |
|
|
const glm::vec3 & | localOffset ) |
|
inline |
Construct with half-height, radius and offset.
- Parameters
-
| hHeight | Half height of the cylindrical part |
| r | Radius of the capsule |
| localOffset | Local position offset from entity center |
◆ AtOffset()
| CapsuleCollider Physics::Component::CapsuleCollider::AtOffset |
( |
float | hHeight, |
|
|
float | r, |
|
|
const glm::vec3 & | localOffset ) |
|
inlinestatic |
Create a capsule at an offset (useful for compound shapes).
- Parameters
-
| hHeight | Half height |
| r | Radius |
| localOffset | Position offset from entity center |
- Returns
- CapsuleCollider
◆ CreateFromHeight()
| CapsuleCollider Physics::Component::CapsuleCollider::CreateFromHeight |
( |
float | capsuleHeight, |
|
|
float | r ) |
|
inlinestatic |
Create a capsule from total height and radius.
- Parameters
-
| capsuleHeight | Total height including caps |
| r | Width/depth radius |
- Returns
- CapsuleCollider
- Note
- By default capsules are vertical (Y-up). Use rotation in Transform to make it horizontal, or use offset to position it differently.
-
Can be used for Character, common values: height 1.8m, radius 0.3m
◆ GetCylinderHeight()
| float Physics::Component::CapsuleCollider::GetCylinderHeight |
( |
| ) |
const |
|
inlinenodiscard |
Get height of just the cylindrical part.
- Returns
- Cylinder height (2 * halfHeight)
◆ GetDiameter()
| float Physics::Component::CapsuleCollider::GetDiameter |
( |
| ) |
const |
|
inlinenodiscard |
Get diameter of the capsule.
- Returns
- Diameter (2 * radius)
◆ GetTotalHeight()
| float Physics::Component::CapsuleCollider::GetTotalHeight |
( |
| ) |
const |
|
inlinenodiscard |
Get total height of the capsule.
- Returns
- Total height (2 * halfHeight + 2 * radius)
◆ IsSphere()
| bool Physics::Component::CapsuleCollider::IsSphere |
( |
| ) |
const |
|
inlinenodiscard |
Check if this capsule degenerates to a sphere.
- Returns
- true if halfHeight == 0
◆ IsValid()
| bool Physics::Component::CapsuleCollider::IsValid |
( |
| ) |
const |
|
inlinenodiscard |
Check if collider is valid.
- Returns
- true if halfHeight >= 0 and radius > 0
◆ SetHeight()
| void Physics::Component::CapsuleCollider::SetHeight |
( |
float | capsuleHeight | ) |
|
|
inline |
Set height (distributes between cylinder and caps).
- Parameters
-
| capsuleHeight | Total height of the capsule |
- Note
- This keeps the current radius and adjusts halfHeight accordingly
◆ halfHeight
| float Physics::Component::CapsuleCollider::halfHeight = 0.5f |
◆ offset
| glm::vec3 Physics::Component::CapsuleCollider::offset {0.0f, 0.0f, 0.0f} |
Local offset from entity transform (center of capsule).
◆ radius
| float Physics::Component::CapsuleCollider::radius = 0.25f |
The documentation for this struct was generated from the following file: