1 #ifndef DYNAMICBODY_HPP 2 #define DYNAMICBODY_HPP 4 #include <Box2D/Box2D.h> 181 #endif // DYNAMICBODY_HPP void allowSleep(bool s)
Set the body to allow sleeping. This increases efficiency and performance of Box2D while also prevent...
Definition: DynamicBody.hpp:102
DynamicBody()
Default constructor - Inaccessible.
Definition: DynamicBody.hpp:27
float getDensity()
Get the density of the body.
Definition: DynamicBody.hpp:57
void setTransform(b2Vec2 position, float angle)
Set the transform (position and angle) of the DynamicBody.
Definition: DynamicBody.hpp:137
void setFixedRotation(bool r)
Set the body's rotation as fixed (no rotation).
Definition: DynamicBody.hpp:92
A class wrapper to ease the instantiation and use of Box2D dynamic bodies. It also performs conversio...
Definition: DynamicBody.hpp:20
b2PolygonShape m_shape
A Box2D polygon shape.
Definition: DynamicBody.hpp:174
void setLinearVelocity(glm::vec2 v)
Set the linear velocity of the body.
Definition: DynamicBody.hpp:153
float getRotation()
Get the rotation of the DynamicBody.
Definition: DynamicBody.hpp:126
float getRestitution()
Get the restitution of the body.
Definition: DynamicBody.hpp:85
b2FixtureDef m_fixtureDef
A Box2D fixture definition structure.
Definition: DynamicBody.hpp:175
void destroyBody()
Destroy the DynamicBody. Safely removes the body using Box2D internals.
Definition: DynamicBody.hpp:168
glm::vec2 getPositionInPixels()
Get the position of the body in screen units (pixels).
Definition: DynamicBody.hpp:145
void setRestitution(float restitution)
Set the restitution (bounciness) for the body.
Definition: DynamicBody.hpp:78
b2Vec2 getPosition()
Get the position of the body in Box2D units (meters).
Definition: DynamicBody.hpp:110
void setDensity(float density)
Set the density of the body.
Definition: DynamicBody.hpp:50
float getFriction()
Get the friction of the body.
Definition: DynamicBody.hpp:71
void setPosition(glm::vec2 position)
Set the position of the DynamicBody.
Definition: DynamicBody.hpp:118
GLRect m_rect
A GLRect structure.
Definition: DynamicBody.hpp:176
Useful for defining size and origin of an OpenGL object.
Definition: GLTransformable.hpp:15
b2BodyDef m_bodyDef
A Box2D body definition structure.
Definition: DynamicBody.hpp:172
glm::vec2 getLinearVelocity()
Get the linear velocity of the body.
Definition: DynamicBody.hpp:161
void setFriction(float friction)
Set the friction for the body.
Definition: DynamicBody.hpp:64
b2World * getWorld()
Get a pointer to the Box2D world.
Definition: DynamicBody.hpp:43
b2Body * m_body
A Box2D body.
Definition: DynamicBody.hpp:173
b2World * m_world
A pointer to a Box2D world.
Definition: DynamicBody.hpp:168