Base class for 3D collider components.
More...
#include <Collider3D.h>
|
|
| ~Collider3D () override |
| | Destroys the collider and releases the native shape/body resources.
|
| void | setEnabled (bool enabled) override |
| | Enables or disables the collider component.
|
|
bool | isValid () const |
| | Returns whether the native collision shape has been created.
|
|
bool | hasOwnBody () const |
| | Returns whether this collider owns a standalone native body.
|
|
bool | isAttached () const |
| | Returns whether the collider is attached to either a world or rigid body.
|
|
bool | isAttachedToWorld () const |
| | Returns whether the collider is attached to a world.
|
|
PhysicsWorld3D * | getWorld () const |
| | Returns the physics world that owns this collider, or nullptr when detached.
|
|
Type | getType () const |
| | Returns this collider's shape category.
|
| JPH::BodyID | internalBody () const |
| | Returns the native body ID for standalone colliders.
|
| JPH::Ref< JPH::Shape > & | internalShape () |
| | Returns the native Jolt shape reference.
|
| void | setTransformInPhysics (const Vec3 &translateInPhysics, const Quat &rotInPhysics) |
| | Sets the relative transform from the node to the physics representation.
|
|
void | syncNodeToPhysics () override |
| | Synchronizes the owner node transform to the native physics body.
|
|
void | syncPhysicsToNode () override |
| | Synchronizes the native physics transform back to the owner node.
|
| Mat4 | getWorldTransform () const override |
| | Returns the collider's current world transform.
|
| void | setSensor (bool bval) |
| | Enables or disables sensor behavior.
|
|
bool | isSensor () const |
| | Returns whether this collider is configured as a sensor.
|
|
const PhysicsMaterial & | getMaterial () const |
| | Returns the collider material settings.
|
| void | setMaterial (const PhysicsMaterial &mat) |
| | Sets the collider material and applies it to the native shape/body when possible.
|
| void | setUserData (void *userData) |
| | Stores opaque caller-owned user data on this collider.
|
|
void * | getUserData () const |
| | Returns the opaque user data pointer assigned to this collider.
|
Base class for 3D collider components.
Provides common functionality and virtual shape creation.
◆ Type
Collider shape category.
| Enumerator |
|---|
| UNKNOWN | Unknown or uninitialized shape.
|
| BOX | Box shape.
|
| SPHERE | Sphere shape.
|
| CYLINDER | Cylinder shape.
|
| CAPSULE | Capsule shape.
|
| CONVEX | Convex hull shape.
|
| MESH | Triangle mesh shape.
|
| HEIGHT_FIELD | Height-field terrain shape.
|
| COMPOUND | Compound shape made from child colliders.
|
◆ setEnabled()
| void setEnabled |
( |
bool | enabled | ) |
|
|
override |
Enables or disables the collider component.
- Parameters
-
| enabled | True to attach or keep the collider active, false to detach it. |
◆ internalBody()
| JPH::BodyID internalBody |
( |
| ) |
const |
|
inline |
Returns the native body ID for standalone colliders.
- Returns
- Native Jolt body ID, or an invalid ID when this collider is body-owned or detached.
◆ internalShape()
| JPH::Ref< JPH::Shape > & internalShape |
( |
| ) |
|
|
inline |
Returns the native Jolt shape reference.
- Returns
- Mutable native shape reference.
◆ setTransformInPhysics()
| void setTransformInPhysics |
( |
const Vec3 & | translateInPhysics, |
|
|
const Quat & | rotInPhysics ) |
Sets the relative transform from the node to the physics representation.
- Parameters
-
| translateInPhysics | Translation offset in local physics space. |
| rotInPhysics | Rotation offset in local physics space. |
◆ getWorldTransform()
| Mat4 getWorldTransform |
( |
| ) |
const |
|
override |
Returns the collider's current world transform.
- Returns
- World transform including the physics transform offset.
◆ setSensor()
| void setSensor |
( |
bool | bval | ) |
|
Enables or disables sensor behavior.
- Parameters
-
| bval | True to make the collider report contacts without physical collision response. |
◆ setMaterial()
| void setMaterial |
( |
const PhysicsMaterial & | mat | ) |
|
Sets the collider material and applies it to the native shape/body when possible.
- Parameters
-
| mat | Material settings to use for this collider. |
◆ setUserData()
| void setUserData |
( |
void * | userData | ) |
|
|
inline |
Stores opaque caller-owned user data on this collider.
- Parameters
-
| userData | Pointer value to associate with the collider. |
The documentation for this class was generated from the following file: