Flatland
|
#include <body.h>
Public Member Functions | |
Body (b2World *physics_world, Entity *entity, const std::string &name, const Color &color, const Pose &pose, b2BodyType body_type, const YAML::Node &properties, double linear_damping=0, double angular_damping=0) | |
constructor for body, takes in all the required parameters More... | |
void | DebugOutput () const |
logs the debugging information for the body | |
Entity * | GetEntity () |
const std::string & | GetName () const |
b2Body * | GetPhysicsBody () |
Get the Box2D body, use this to manipulate the body in physics through the Box2D methods. More... | |
int | GetFixturesCount () const |
Count the number of fixtures. More... | |
const Color & | GetColor () const |
void | SetColor (const Color &color) |
Set of the color of the body. | |
virtual | ~Body () |
Body (const Body &)=delete | |
Body & | operator= (const Body &)=delete |
Public Attributes | |
Entity * | entity_ |
The entity the body belongs to. | |
std::string | name_ |
name of the body, unique within a model | |
b2Body * | physics_body_ |
Box2D physics body. | |
Color | color_ |
color, for visualization | |
YAML::Node | properties_ |
Properties document for plugins to use. | |
This class defines a body in the simulation. It wraps around the Box2D physics body providing extra data and useful methods
flatland_server::Body::Body | ( | b2World * | physics_world, |
Entity * | entity, | ||
const std::string & | name, | ||
const Color & | color, | ||
const Pose & | pose, | ||
b2BodyType | body_type, | ||
const YAML::Node & | properties, | ||
double | linear_damping = 0 , |
||
double | angular_damping = 0 |
||
) |
constructor for body, takes in all the required parameters
[in] | physics_world | Box2D physics world |
[in] | entity | Entity the body is tied to |
[in] | name | Name for the body |
[in] | color | Color in r, g, b, a |
[in] | pose | Pose to place the body at |
[in] | body_type | Box2D body type either dynamic, kinematic, or static |
[in] | properties | per-object YAML properties for plugins to reference |
[in] | linear_damping | Box2D body linear damping |
[in] | angular_damping | Box2D body angular damping |
|
virtual |
Destructor for the body
|
delete |
Prevent copying since it is creates complications with constructing and destructing bodies
Entity * flatland_server::Body::GetEntity | ( | ) |
int flatland_server::Body::GetFixturesCount | ( | ) | const |
Count the number of fixtures.
const std::string & flatland_server::Body::GetName | ( | ) | const |
b2Body * flatland_server::Body::GetPhysicsBody | ( | ) |
Get the Box2D body, use this to manipulate the body in physics through the Box2D methods.