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

#include <model_body.h>

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

Public Member Functions

 ModelBody (b2World *physics_world, CollisionFilterRegistry *cfr, Model *model, const std::string &name, const Color &color, const Pose &pose, b2BodyType body_type, const YAML::Node &properties, double linear_damping, double angular_damping)
 Constructor for the Model Body. More...
 
const CollisionFilterRegistryGetCfr () const
 
void LoadFootprints (YamlReader &footprints_reader)
 Load footprints (Box2D fixtures) into the body. More...
 
void ConfigFootprintDef (YamlReader &footprint_reader, b2FixtureDef &fixture_def)
 Configures the common properties of footprints. More...
 
void LoadCircleFootprint (YamlReader &footprint_reader)
 Loads a circle footprint. More...
 
void LoadPolygonFootprint (YamlReader &footprint_reader)
 Loads a circle footprint. More...
 
- Public Member Functions inherited from 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 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
 

Static Public Member Functions

static ModelBodyMakeBody (b2World *physics_world, CollisionFilterRegistry *cfr, Model *model, YamlReader &body_node)
 Factory method to create a model body. More...
 

Public Attributes

CollisionFilterRegistrycfr_
 collision filter registry
 
- Public Attributes inherited from flatland_server::Body
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 model body which is a body that is always used together with a model. It contains members and useful methods that is specfic for a body in a model

Constructor & Destructor Documentation

flatland_server::ModelBody::ModelBody ( b2World *  physics_world,
CollisionFilterRegistry cfr,
Model model,
const std::string &  name,
const Color color,
const Pose pose,
b2BodyType  body_type,
const YAML::Node &  properties,
double  linear_damping,
double  angular_damping 
)

Constructor for the Model Body.

Parameters
[in]physics_worldBox2D physics world
[in]cfrCollision filter registry
[in]modelModel the body belongs to
[in]nameName of the body
[in]colorColor of the body for visualization
[in]poseThe pose to place the body at
[in]body_typeType of Box2D body, either dynamic, static, or kinematic
[in]propertiesper-object YAML properties for plugins to reference
[in]linear_dampingBox2D body linear damping
[in]angular_dampingBox2D body angular damping

Member Function Documentation

void flatland_server::ModelBody::ConfigFootprintDef ( YamlReader footprint_reader,
b2FixtureDef &  fixture_def 
)

Configures the common properties of footprints.

Parameters
[in]footprint_readerYAML reader for node containing the footprint parameters
[out]fixture_defBox2D fixture definition
const CollisionFilterRegistry * flatland_server::ModelBody::GetCfr ( ) const
Returns
The collision filter registry
void flatland_server::ModelBody::LoadCircleFootprint ( YamlReader footprint_reader)

Loads a circle footprint.

Parameters
[in]footprint_readerYAML reader for node containing the footprint parameters
void flatland_server::ModelBody::LoadFootprints ( YamlReader footprints_reader)

Load footprints (Box2D fixtures) into the body.

Parameters
[in]footprints_readerYAML reader for node containing the footprints parameters
void flatland_server::ModelBody::LoadPolygonFootprint ( YamlReader footprint_reader)

Loads a circle footprint.

Parameters
[in]footprint_readerYAML reader for node containing the footprint parameters
ModelBody * flatland_server::ModelBody::MakeBody ( b2World *  physics_world,
CollisionFilterRegistry cfr,
Model model,
YamlReader body_node 
)
static

Factory method to create a model body.

Parameters
[in]physics_worldBox2D physics world
[in]cfrCollision filter registry
[in]modelThe model this model body belongs to
[in]body_nodeYAML reader for node containing the body parameters

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