Classes

PhysicsJolt/Body

Brief descriptions

Classes

nau::physics::jolt::JoltPhysicsBody

Implements nau::physics::IPhysicsBody interface utilizing Jolt physics engine.

Detailed information

physics::jolt::JoltPhysicsBody

engine/core/modules/physicsJolt/include/nau/physics/jolt/jolt_physics_body.h

class JoltPhysicsBody : public nau::physics::IPhysicsBody

Implements nau::physics::IPhysicsBody interface utilizing Jolt physics engine.

Public Functions

JoltPhysicsBody(Ptr<JoltPhysicsWorld> physWorld, Uid originObjectUid, const PhysicsBodyCreationData &creationData)
~JoltPhysicsBody()
virtual void getTransform(math::mat4 &transform) const override

Retrieves the transformation matrix of the body.

Parameters:

Output[out] transformation matrix.

virtual void setTransform(const nau::math::Transform &transform) override

Sets the body transform to the specified value.

Parameters:

transform[in] Value to assign.

virtual void setCollisionChannel(CollisionChannel channel) override

Attaches a collision channel to the body.

Parameters:

channel[in] Index of the collision channel to attach the body to.

virtual void setDebugDrawEnabled(bool enabled) override

Switches physics debug drawing for the body on or off.

Parameters:

enabled[in] Indicates whether physics debug drawing should be turned on or off.

virtual bool isTrigger() const override

Checks whether the body is used a trigger.

Returns:

true if the body is trigger, false otherwise (i.e. the body is a collidable object).

virtual void addForce(const nau::math::vec3 &force) override

Applies the force to the center of mass of the physics body.

Parameters:

force[in] Force to apply.

virtual void addForce(const nau::math::vec3 &force, const nau::math::vec3 &applyPoint) override

Applies the force to the physics body.

Parameters:
  • force[in] Force to apply.

  • applyPoint[in] Point to apply the force at.

virtual void addTorque(const nau::math::vec3 &torque) override

Applies the torque to the physics body.

Parameters:

torque[in] Torque to apply.

virtual void addImpulse(const nau::math::vec3 &impulse) override

Applies the force to the center of mass of the physics body.

Parameters:

impulse[in] Impulse to apply.

virtual void addImpulse(const nau::math::vec3 &impulse, const nau::math::vec3 &applyPoint) override

Applies the impulse to the physics body.

Parameters:
  • force[in] Impulse to apply.

  • applyPoint[in] Point to apply the impulse at.

bool debugDrawEnabled() const

Checks whether debug drawing is enabled for the body.

Returns:

true if debug drawing is enabled for the body, false otherwise.

Uid getSceneObjectUid() const

Private Functions

void initializeJoltBody(const PhysicsBodyCreationData &creationData)

Creates the body and adds it to the physical world.

Parameters:

creationData[in] Physical properties of the body.

Private Members

eastl::shared_ptr<JoltCollisionShape> m_collisionShape
Ptr<JoltPhysicsWorld> m_physWorld
Uid m_sceneObjectUid
JPH::BodyID m_bodyId
bool m_debugDrawEnabled = false

< A handle to the body within the physical world.

bool m_isTrigger = false

< Indicates whether debug drawing is enabled for the body.