Class RigidBodyComponent

Inheritance Relationships

Base Types

Derived Types

Class Documentation

class RigidBodyComponent : public CollisionComponent, public btMotionState

Component that reacts to and moves according to physics.

Subclassed by BoxColliderComponent, CapsuleColliderComponent, SphereColliderComponent, StaticMeshColliderComponent

Public Functions

virtual ~RigidBodyComponent()
void applyForce(const Vector3 &force)
void applyTorque(const Vector3 &torque)
Vector3 getAngularFactor() const
void setAngularFactor(const Vector3 &factors)
void setAxisLock(bool enabled)
Vector3 getOffset() const
void setOffset(const Vector3 &offset)
Vector3 getGravity() const
void setGravity(const Vector3 &gravity)
PhysicsMaterial getMaterial() const
Vector3 getVelocity()
void setVelocity(const Vector3 &velocity)
Vector3 getAngularVelocity()
void setAngularVelocity(const Vector3 &angularVel)
void translate(const Vector3 &vec)
void setTransform(const Matrix &mat)
Matrix getTransform()
bool isMoveable()
void setMoveable(bool enabled)
bool canSleep()
void setSleepable(bool enabled)
bool isCCD()
void setCCD(bool enabled)
bool isGeneratesHitEvents()
void setGeneratedHitEvents(bool enabled)
bool isKinematic()
void setKinematic(bool enabled)
void setupRigidBody()
bool setupData()

Perform setting up internal data needed from other components after they have been added to the owning entity.

JSON::json getJSON() const

Get JSON representation of the component data needed to re-construct component from memory.

void draw()

Expose the component data with ImGui.

void highlight()

Protected Functions

RigidBodyComponent(Entity &owner, const PhysicsMaterial &material, float volume, const Vector3 &offset, const Vector3 &gravity, const Vector3 &angularFactor, int collisionGroup, int collisionMask, bool isMoveable, bool isKinematic, bool generatesHitEvents, bool canSleep, bool isCCD, const Ref<btCollisionShape> &collisionShape)
void getWorldTransform(btTransform &worldTrans) const
void setWorldTransform(const btTransform &worldTrans)
void updateTransform()
void handleHit(Hit *hit)

Protected Attributes

Ref<btCollisionShape> m_CollisionShape
btRigidBody *m_Body = nullptr
bool m_IsGeneratesHitEvents
btScalar m_Mass
Vector3 m_Gravity
Vector3 m_AngularFactor
Vector3 m_Offset
float m_Volume
bool m_IsMoveable
bool m_IsKinematic
bool m_IsSleepable
bool m_IsCCD
PhysicsMaterial m_Material
btVector3 m_LocalInertia