72 void Update(
float deltaTime)
override;
91 void ClearCollisionState();
110 void SetMass(
float mass) { m_mass = mass > 0.0f ? mass : 1.0f; }
121 bool m_hadCollision =
false;
124 bool m_hadGroundCollision =
false;
127 bool m_hadWallCollision =
false;
132 bool m_useGravity =
false;
133 bool m_isGrounded =
false;
135 float m_terminalVelocity = 50.0f;
bool GetUseGravity() const
Math::Vector3D GetVelocity() const
void SetUseGravity(bool useGravity)
float GetTerminalVelocity() const
Math::Vector3D GetGroundNormal() const
BodyType GetBodyType() const
Math::Vector3D GetWallNormal() const
bool HadWallCollision() const
void Update(float deltaTime) override
void SetGravity(const Math::Vector3D &gravity)
Math::Vector3D GetGravity() const
RigidbodyComponent(GameObject *owner, BodyType type=BodyType::Kinematic)
void SetGrounded(bool grounded)
bool Initialize() override
One-time setup, called after the component is attached and the owner is initialized.
~RigidbodyComponent() override=default
void SetBodyType(BodyType type)
bool HadCollision() const
void SetVelocity(const Math::Vector3D &velocity)
void SetTerminalVelocity(float tv)
void AddForce(const Math::Vector3D &force)
bool HadGroundCollision() const
void ResolveCollision(const Math::Vector3D &normal, float penetration)
Pushes the body out along normal by penetration and updates ground/wall collision state.
Math::Vector3D GetLastCollisionNormal() const