Box2D physics body.
More...
#include <RigidBody.hpp>
Box2D physics body.
Definition at line 33 of file RigidBody.hpp.
◆ RigidBody() [1/4]
galaxy::components::RigidBody::RigidBody |
( |
| ) |
|
◆ RigidBody() [2/4]
galaxy::components::RigidBody::RigidBody |
( |
const nlohmann::json & | json | ) |
|
JSON constructor.
- Parameters
-
json | JSON defining object. |
Definition at line 36 of file RigidBody.cpp.
◆ RigidBody() [3/4]
galaxy::components::RigidBody::RigidBody |
( |
RigidBody && | rb | ) |
|
◆ ~RigidBody()
galaxy::components::RigidBody::~RigidBody |
( |
| ) |
|
|
virtual |
◆ RigidBody() [4/4]
galaxy::components::RigidBody::RigidBody |
( |
const RigidBody & | | ) |
|
|
privatedelete |
◆ operator=() [1/2]
◆ set_shape()
void galaxy::components::RigidBody::set_shape |
( |
const float | hw, |
|
|
const float | hh ) |
Set new box2d collider shape.
- Parameters
-
hw | Half extant width. |
hh | Half extant height. |
Definition at line 87 of file RigidBody.cpp.
◆ set_type()
void galaxy::components::RigidBody::set_type |
( |
const b2BodyType | type | ) |
|
Set body type.
- Parameters
-
type | Box2d body enum type. |
Definition at line 97 of file RigidBody.cpp.
◆ set_density()
void galaxy::components::RigidBody::set_density |
( |
const float | density | ) |
|
Set body density.
- Parameters
-
density | Affects mass of body. |
Definition at line 102 of file RigidBody.cpp.
◆ set_friction()
void galaxy::components::RigidBody::set_friction |
( |
const float | friction | ) |
|
Set friction of body.
- Parameters
-
friction | Affects movement against other bodies during collision. |
Definition at line 112 of file RigidBody.cpp.
◆ set_restitution()
void galaxy::components::RigidBody::set_restitution |
( |
const float | restitution | ) |
|
Set restitution of body.
- Parameters
-
restitution | Affects bounce of body. |
Definition at line 120 of file RigidBody.cpp.
◆ set_restitution_threshold()
void galaxy::components::RigidBody::set_restitution_threshold |
( |
const float | restitution_threshold | ) |
|
Set restitution threshold.
- Parameters
-
restitution_threshold | Affects bounce threshold of body. |
Definition at line 128 of file RigidBody.cpp.
◆ set_bullet()
void galaxy::components::RigidBody::set_bullet |
( |
const bool | is_bullet | ) |
|
Set if body is a bullet type.
- Parameters
-
is_bullet | Enables continous collision. |
Definition at line 136 of file RigidBody.cpp.
◆ set_fixed_rotation()
void galaxy::components::RigidBody::set_fixed_rotation |
( |
const bool | fixed_rotation | ) |
|
Set rotation status of body.
- Parameters
-
fixed_rotation | Can body rotate. |
Definition at line 141 of file RigidBody.cpp.
◆ get_shape()
const glm::vec2 & galaxy::components::RigidBody::get_shape |
( |
| ) |
const |
|
nodiscard |
Get body shape.
- Returns
- Const glm::vec2 reference.
Definition at line 146 of file RigidBody.cpp.
◆ get_type()
b2BodyType galaxy::components::RigidBody::get_type |
( |
| ) |
const |
|
nodiscard |
Get body type.
- Returns
- Box2d enum body type.
Definition at line 151 of file RigidBody.cpp.
◆ get_density()
float galaxy::components::RigidBody::get_density |
( |
| ) |
const |
|
nodiscard |
◆ get_friction()
float galaxy::components::RigidBody::get_friction |
( |
| ) |
const |
|
nodiscard |
◆ get_restitution()
float galaxy::components::RigidBody::get_restitution |
( |
| ) |
const |
|
nodiscard |
Get body restitution.
- Returns
- Float.
Definition at line 166 of file RigidBody.cpp.
◆ get_restitution_threshold()
float galaxy::components::RigidBody::get_restitution_threshold |
( |
| ) |
const |
|
nodiscard |
Get restitution threshold.
- Returns
- Float.
Definition at line 171 of file RigidBody.cpp.
◆ is_bullet()
bool galaxy::components::RigidBody::is_bullet |
( |
| ) |
const |
|
nodiscard |
Is this a bullet style body.
- Returns
- True if continously colliding.
Definition at line 176 of file RigidBody.cpp.
◆ is_rotation_fixed()
bool galaxy::components::RigidBody::is_rotation_fixed |
( |
| ) |
const |
|
nodiscard |
Get rotation status.
- Returns
- True if body can't rotate.
Definition at line 181 of file RigidBody.cpp.
◆ serialize()
nlohmann::json galaxy::components::RigidBody::serialize |
( |
| ) |
|
|
nodiscardoverridevirtual |
◆ deserialize()
void galaxy::components::RigidBody::deserialize |
( |
const nlohmann::json & | json | ) |
|
|
overridevirtual |
◆ operator=() [2/2]
Copy assignment operator.
◆ m_shape
glm::vec2 galaxy::components::RigidBody::m_shape |
|
private |
◆ m_type
b2BodyType galaxy::components::RigidBody::m_type |
|
private |
◆ m_density
float galaxy::components::RigidBody::m_density |
|
private |
How heavy it is in relation to its area.
Definition at line 227 of file RigidBody.hpp.
◆ m_friction
float galaxy::components::RigidBody::m_friction |
|
private |
◆ m_restitution
float galaxy::components::RigidBody::m_restitution |
|
private |
◆ m_restitution_threshold
float galaxy::components::RigidBody::m_restitution_threshold |
|
private |
◆ m_bullet
bool galaxy::components::RigidBody::m_bullet |
|
private |
Is this a bullet? Does continous collision checking.
Definition at line 247 of file RigidBody.hpp.
◆ m_fixed_rotation
bool galaxy::components::RigidBody::m_fixed_rotation |
|
private |
◆ m_body
b2Body* galaxy::components::RigidBody::m_body |
|
private |
◆ m_world
b2World* galaxy::components::RigidBody::m_world |
|
private |
The documentation for this class was generated from the following files: