Flatland
Public Member Functions | Public Attributes | List of all members
flatland_server::Body Class Reference

#include <body.h>

Inheritance diagram for flatland_server::Body:
Inheritance graph
[legend]
Collaboration diagram for flatland_server::Body:
Collaboration graph
[legend]

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
 
EntityGetEntity ()
 
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 ColorGetColor () const
 
void SetColor (const Color &color)
 Set of the color of the body.
 
virtual ~Body ()
 
 Body (const Body &)=delete
 
Bodyoperator= (const Body &)=delete
 

Public Attributes

Entityentity_
 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.
 

Detailed Description

This class defines a body in the simulation. It wraps around the Box2D physics body providing extra data and useful methods

Constructor & Destructor Documentation

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

Parameters
[in]physics_worldBox2D physics world
[in]entityEntity the body is tied to
[in]nameName for the body
[in]colorColor in r, g, b, a
[in]posePose to place the body at
[in]body_typeBox2D body type either dynamic, kinematic, or static
[in]propertiesper-object YAML properties for plugins to reference
[in]linear_dampingBox2D body linear damping
[in]angular_dampingBox2D body angular damping
flatland_server::Body::~Body ( )
virtual

Destructor for the body

flatland_server::Body::Body ( const Body )
delete

Prevent copying since it is creates complications with constructing and destructing bodies

Member Function Documentation

const Color & flatland_server::Body::GetColor ( ) const
Returns
Color of the body
Entity * flatland_server::Body::GetEntity ( )
Returns
entity associated with the body
int flatland_server::Body::GetFixturesCount ( ) const

Count the number of fixtures.

Returns
number of fixtures in the body
const std::string & flatland_server::Body::GetName ( ) const
Returns
name of the body
b2Body * flatland_server::Body::GetPhysicsBody ( )

Get the Box2D body, use this to manipulate the body in physics through the Box2D methods.

Returns
Pointer to Box2D physics body

The documentation for this class was generated from the following files: