8#ifndef GALAXY_COMPONENTS_RIGIDBODY_HPP_
9#define GALAXY_COMPONENTS_RIGIDBODY_HPP_
11#include <box2d/b2_body.h>
12#include <glm/vec2.hpp>
72 void set_shape(
const float hw,
const float hh);
79 void set_type(
const b2BodyType type);
200 void deserialize(
const nlohmann::json& json)
override;
RigidBody(const RigidBody &)=delete
Copy constructor.
float m_friction
How slippery it is.
float get_friction() const
Get body friction.
void set_friction(const float friction)
Set friction of body.
float m_restitution
How bouncy the fixture is.
b2BodyType m_type
Body type.
b2Body * m_body
Pointer to Box2D body.
bool m_fixed_rotation
Can this body rotate?
void set_type(const b2BodyType type)
Set body type.
b2BodyType get_type() const
Get body type.
RigidBody & operator=(const RigidBody &)=delete
Copy assignment operator.
void set_restitution_threshold(const float restitution_threshold)
Set restitution threshold.
glm::vec2 m_shape
Box2D body shape.
void set_restitution(const float restitution)
Set restitution of body.
void set_fixed_rotation(const bool fixed_rotation)
Set rotation status of body.
void set_bullet(const bool is_bullet)
Set if body is a bullet type.
bool is_bullet() const
Is this a bullet style body.
const glm::vec2 & get_shape() const
Get body shape.
float get_density() const
Get body density.
void set_density(const float density)
Set body density.
float get_restitution_threshold() const
Get restitution threshold.
void deserialize(const nlohmann::json &json) override
Deserializes from object.
bool m_bullet
Is this a bullet? Does continous collision checking.
float m_density
How heavy it is in relation to its area.
float get_restitution() const
Get body restitution.
virtual ~RigidBody()
Destructor.
b2World * m_world
Pointer to the Box2D world.
void set_shape(const float hw, const float hh)
Set new box2d collider shape.
RigidBody & operator=(RigidBody &&)
Move assignment operator.
float m_restitution_threshold
Restitution velocity threshold.
bool is_rotation_fixed() const
Get rotation status.
nlohmann::json serialize() override
Serializes object.
Wrapper around entt::registry to expand functionality.
Allows a class to be serialized.
Update entities with a rigid body component.