1 #ifndef CHARACTERBODY_HPP 2 #define CHARACTERBODY_HPP 4 #include <Box2D/Box2D.h> 238 #endif // CHARACTERBODY_HPP glm::vec2 getPositionInPixels()
Get the position of the body in screen units (pixels).
Definition: CharacterBody.hpp:143
SensorData * m_footSensorData
Foot sensor data.
Definition: CharacterBody.hpp:230
void setLinearVelocity(glm::vec2 v)
Set the linear velocity of the body.
Definition: CharacterBody.hpp:151
float getFriction()
Get the friction of the body.
Definition: CharacterBody.hpp:70
b2PolygonShape m_shape
A Box2D polygon shape.
Definition: CharacterBody.hpp:226
SensorData * m_leftSensorData
Left sensor data.
Definition: CharacterBody.hpp:231
SensorData * m_topSensorData
Top sensor data.
Definition: CharacterBody.hpp:233
SensorData * m_rightSensorData
Right sensor data.
Definition: CharacterBody.hpp:232
b2Vec2 getPosition()
Get the position of the body in Box2D units (meters).
Definition: CharacterBody.hpp:109
b2BodyDef m_bodyDef
A Box2D body definition structure.
Definition: CharacterBody.hpp:224
A class wrapping some user data for Box2D fixtures. Includes data for number of contacts being made t...
Definition: SensorData.hpp:30
b2World * getWorld()
Get a pointer to the Box2D world.
Definition: CharacterBody.hpp:42
glm::vec2 getLinearVelocity()
Get the linear velocity of the body.
Definition: CharacterBody.hpp:159
void setFixedRotation(bool r)
Set the body's rotation as fixed (no rotation).
Definition: CharacterBody.hpp:91
void setFriction(float friction)
Set the friction for the body.
Definition: CharacterBody.hpp:63
SensorData * rightSensor()
Get the right sensor data.
Definition: CharacterBody.hpp:190
b2FixtureDef m_fixtureDef
A Box2D fixture definition structure.
Definition: CharacterBody.hpp:227
void setPosition(glm::vec2 position)
Set the position of the CharacterBody.
Definition: CharacterBody.hpp:117
SensorData * leftSensor()
Get the left sensor data.
Definition: CharacterBody.hpp:182
A class representing a Box2D dynamic body with special fixtures and data used to track collisions and...
Definition: CharacterBody.hpp:25
void setTransform(b2Vec2 position, float angle)
Set the transform data (position and angle) for the CharacterBody.
Definition: CharacterBody.hpp:135
void destroyBody()
Destroy the CharacterBody. Safe destruction using the internals of Box2D.
Definition: CharacterBody.hpp:198
CharacterBody()
Default constructor - Inaccessible.
Definition: CharacterBody.hpp:32
void setDensity(float density)
Set the density of the body.
Definition: CharacterBody.hpp:49
bool canJump()
Check if the CharacterBody can jump. Based on SensorData from foot sensor.
int m_characterID
The unique id of the character body.
Definition: CharacterBody.hpp:229
float getDensity()
Get the density of the body.
Definition: CharacterBody.hpp:56
int getCharacterBodyID()
Get the CharacterBody ID.
Definition: CharacterBody.hpp:166
GLRect m_rect
A GLRect structure.
Definition: CharacterBody.hpp:228
Useful for defining size and origin of an OpenGL object.
Definition: GLTransformable.hpp:15
b2World * m_world
A pointer to a Box2D world.
Definition: CharacterBody.hpp:223
float getRestitution()
Get the restitution of the body.
Definition: CharacterBody.hpp:84
void setRestitution(float restitution)
Set the restitution (bounciness) for the body.
Definition: CharacterBody.hpp:77
SensorData * topSensor()
Get the top sensor data.
Definition: CharacterBody.hpp:198
bool touchingWall()
Check if the CharacterBody is touching a wall. Based on SensorData from left, right, and top.
SensorData * footSensor()
Get the foot sensor data.
Definition: CharacterBody.hpp:174
float getRotation()
Get the rotation for the CharacterBody.
Definition: CharacterBody.hpp:124
b2Body * m_body
A Box2D body.
Definition: CharacterBody.hpp:225
void allowSleep(bool s)
Set the body to allow sleeping. This increases efficiency and performance of Box2D while also prevent...
Definition: CharacterBody.hpp:101