Classes

Physics/Body

Brief descriptions

Structures

nau::physics::PhysicsBodyCreationData

Encapsulates physical properties that are used to initialize a physical body.

Classes

nau::physics::IPhysicsBody

Detailed information

physics::PhysicsBodyCreationData

engine/core/modules/physics/include/nau/physics/physics_body.h

struct PhysicsBodyCreationData

Encapsulates physical properties that are used to initialize a physical body.

Public Members

ICollisionShape::Ptr collisionShape

A pointer to the collision shape to be attached to the associated body.

CollisionChannel collisionChannel = {}

Collision channel to be attached to the associated body.

TFloat mass = .0f

Mass of the associated body.

TFloat friction = .0f

Degree of how the body resists being dragged. It has to be between 0.0 (no friction) and 1.0 (the body will stick to the surface and stay immobile).

TFloat restitution = .0f

Degree of body tougheness on collision. It has to be between 0.0 (completely inelastic collision response) and 1.0 (completely elastic collision response).

math::vec3 position = math::vec3::zero()

Body initial position.

math::quat rotation = math::quat::identity()

Body initial rotation.

math::vec3 comOffset = math::vec3::zero()

Center of mass offset.

MotionType motionType = MotionType::Static

Indicates body motion type (i.e. whether it is static, kinematic or dynamic).

bool debugDraw = false

Indicates whether the body shape is rendered at debug drawing.

bool isTrigger = false

Indicates whether the body is a trigger or not (i.e. it is a collidable object).

physics::IPhysicsBody

engine/core/modules/physics/include/nau/physics/physics_body.h

class IPhysicsBody : public virtual IRefCounted

Subclassed by nau::physics::jolt::JoltPhysicsBody

Private Functions

virtual IRefCounted void getTransform (math::mat4 &transform) const =0

Retrieves the transformation matrix of the body.

Parameters:

Output[out] transformation matrix.

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

Sets the body transform to the specified value.

Parameters:

transform[in] Value to assign.

virtual void setCollisionChannel(CollisionChannel channel) = 0

Attaches a collision channel to the body.

Only a single collision channel is allowed for a body.

Parameters:

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

virtual void setDebugDrawEnabled(bool enabled) = 0

Sets the body transform to the specified value.

Parameters:

transform[in] Value to assign.

virtual bool isTrigger() const = 0

Binds the body to the RigidBodyComponent.

Checks whether the body is used a trigger.

Parameters:

component[in] Component to bind the body to.

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) = 0

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) = 0

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) = 0

Applies the torque to the physics body.

Parameters:

torque[in] Torque to apply.

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

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) = 0

Applies the impulse to the physics body.

Parameters:
  • force[in] Impulse to apply.

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