Struct rigidbody

Struct Documentation

struct legion::physics::rigidbody

Public Functions

template<typename Archive>
inline void serialize(Archive &archive)
inline void addForce(math::vec3 force)

Pushes the rigidbody in the direction parallel to ‘force’ and equal to the length of ‘force’.


This does NOT cause torque

inline void addForceAt(math::vec3 worldForcePosition, math::vec3 force)

Adds a force in the direction of ‘force’ and.

inline void setMass(float mass)
inline void setRestitution(float newRestitution)
inline void setFriction(float newFriction)
inline void resetAccumulators()
inline void UpdateInertiaTensor(math::quat orientation)

Public Members

float inverseMass = 1.0f
math::vec3 velocity = math::vec3(0.0)
math::vec3 acc = math::vec3(0.0)
float linearDrag
math::mat3 localInverseInertiaTensor = math::mat3(6.0f)
math::mat3 globalInverseInertiaTensor = localInverseInertiaTensor
math::vec3 angularAcc = math::vec3(0.0)
math::vec3 angularVelocity = math::vec3(0.0)
float angularDrag = 0.01f
math::vec3 forceAccumulator = math::vec3(0.0)
math::vec3 torqueAccumulator = math::vec3(0.0)
math::vec3 globalCentreOfMass = math::vec3(0.0)
float restitution = 0.3f
float friction = 0.3f
bool isAsleep

Public Static Functions

static inline float calculateRestitution(float restitutionA, float restitutionB)
static inline float calculateFriction(float frictionA, float frictionB)