Represents a single rigid body or trigger volume inside the physics simulation.
More...
|
| | kPhysicsObject () |
| | ~kPhysicsObject () |
| void | setPosition (const kVec3 &position) |
| | Teleports the body to a new world-space position.
|
| void | setRotation (const kQuat &rotation) |
| | Sets the body's world-space orientation.
|
| kVec3 | getPosition () const |
| | Returns the body's current world-space position.
|
| kQuat | getRotation () const |
| | Returns the body's current world-space orientation.
|
| void | setLinearVelocity (const kVec3 &velocity) |
| | Directly sets the linear velocity (m/s).
|
| void | setAngularVelocity (const kVec3 &velocity) |
| | Directly sets the angular velocity (rad/s).
|
| kVec3 | getLinearVelocity () const |
| | Returns the current linear velocity (m/s).
|
| kVec3 | getAngularVelocity () const |
| | Returns the current angular velocity (rad/s).
|
| void | applyForce (const kVec3 &force) |
| | Applies a continuous force (N) at the centre of mass this step.
|
| void | applyImpulse (const kVec3 &impulse) |
| | Applies an instantaneous impulse (kg·m/s) at the centre of mass.
|
| void | applyTorque (const kVec3 &torque) |
| | Applies a torque (N·m) for the current simulation step.
|
| void | setMass (float mass) |
| | Changes the body mass (kg). No-op for Static bodies.
|
| void | setFriction (float friction) |
| | Sets the coefficient of friction (0–1).
|
| void | setRestitution (float restitution) |
| | Sets the coefficient of restitution / bounciness (0–1).
|
| void | setLinearDamping (float damping) |
| | Sets the linear velocity drag coefficient (per second).
|
| void | setAngularDamping (float damping) |
| | Sets the angular velocity drag coefficient (per second).
|
| void | setGravityFactor (float factor) |
| | Scales the world gravity applied to this body.
|
| bool | isActive () const |
| | Returns true if the body is currently awake and being simulated.
|
| kPhysicsObjectType | getObjectType () const |
| | Returns the motion type (Dynamic / Static / Kinematic / Trigger).
|
| kPhysicsShapeType | getShapeType () const |
| | Returns the underlying collision shape type.
|
| bool | init (void *physicsSystem, const kPhysicsObjectDesc &desc) |
| | Initialises the body inside an existing Jolt PhysicsSystem.
|
| void | uninit () |
| | Removes the body from the simulation and releases its resources.
|
| uint32_t | getBodyId () const |
| | Returns the internal Jolt body ID (cast from JPH::BodyID).
|
Represents a single rigid body or trigger volume inside the physics simulation.
Instances must be created via kPhysicsManager::createObject() and destroyed with kPhysicsManager::destroyObject().
physicsManager->update(deltaTime);
kVec3 getPosition() const
Returns the body's current world-space position.
void applyImpulse(const kVec3 &impulse)
Applies an instantaneous impulse (kg·m/s) at the centre of mass.
@ Box
Axis-aligned box defined by half-extents.
Definition kphysicsobject.h:25
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33
@ Dynamic
Full rigid-body simulation (affected by forces and gravity).
Definition kphysicsobject.h:76
All parameters needed to create a kPhysicsObject.
Definition kphysicsobject.h:92
kVec3 position
Definition kphysicsobject.h:95
kPhysicsObjectType type
Definition kphysicsobject.h:94
kPhysicsShapeDesc shape
Definition kphysicsobject.h:93
kVec3 halfExtents
Box / Plane: per-axis half-extents (Plane uses x,z).
Definition kphysicsobject.h:59
kPhysicsShapeType type
Definition kphysicsobject.h:58