68 [[nodiscard]]
float Mass()
const;
73 [[nodiscard]]
float InvMass()
const;
130 bool _takesGravity{};
132 float _staticFriction{};
133 float _dynamicFriction{};
134 float _restitution{};
Contains the CollisionBody struct.
A body that can receive collisions.
Definition CollisionBody.hpp:26
Definition BroadPhaseGrid.hpp:18
A Rigidbody that has dynamics.
Definition Rigidbody.hpp:21
bool TakesGravity() const
Gets a boolean indicating whether this body takes gravity.
Definition Rigidbody.cpp:73
float Mass() const
Computes the mass of this body. Only the inverted mass is stored, so it's computed as 1 / InvMass();.
Definition Rigidbody.cpp:47
float Restitution() const
Gets the restitution of this body. Can be seen as the "Bounciness".
Definition Rigidbody.cpp:107
void SetStaticFriction(float staticFriction)
Sets the static friction of this body.
Definition Rigidbody.cpp:92
float StaticFriction() const
Gets the static friction of this body.
Definition Rigidbody.cpp:87
void SetForce(const Vector2 &force)
Sets the force of this body.
Definition Rigidbody.cpp:32
void SetTakesGravity(bool takesGravity)
Sets a boolean indicating whether this body takes gravity.
Definition Rigidbody.cpp:78
void SetGravityForce(const Vector2 &gravityForce)
Sets the gravity force.
Definition Rigidbody.cpp:17
float InvMass() const
Returns 1 / Mass of this body.
Definition Rigidbody.cpp:52
const Vector2 & Force() const
Gets the force on this body.
Definition Rigidbody.cpp:22
float DynamicFriction() const
Gets the dynamic friction of this body.
Definition Rigidbody.cpp:97
const Vector2 & Velocity() const
Gets the velocity of this body.
Definition Rigidbody.cpp:37
Rigidbody()
Definition Rigidbody.cpp:5
const Vector2 & GravityForce() const
Gets the force of the gravity on this body.
Definition Rigidbody.cpp:12
void SetMass(float mass)
Sets the mass of this body.
Definition Rigidbody.cpp:57
void SetRestitution(float restitution)
Sets the restitution of this body. Can be seen as the "Bounciness".
Definition Rigidbody.cpp:112
void ApplyForce(const Vector2 &addedForce)
Adds force to this body.
Definition Rigidbody.cpp:27
void SetVelocity(const Vector2 &velocity)
Sets the velocity of this body.
Definition Rigidbody.cpp:42
void SetDynamicFriction(float dynamicFriction)
Sets the dynamic friction of this body.
Definition Rigidbody.cpp:102
A struct representing a 2D Vector.
Definition Vector2.hpp:21