Flatland
|
#include <model_body.h>
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 CollisionFilterRegistry * | GetCfr () 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 | |
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 |
Static Public Member Functions | |
static ModelBody * | MakeBody (b2World *physics_world, CollisionFilterRegistry *cfr, Model *model, YamlReader &body_node) |
Factory method to create a model body. More... | |
Public Attributes | |
CollisionFilterRegistry * | cfr_ |
collision filter registry | |
Public Attributes inherited from flatland_server::Body | |
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 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
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.
[in] | physics_world | Box2D physics world |
[in] | cfr | Collision filter registry |
[in] | model | Model the body belongs to |
[in] | name | Name of the body |
[in] | color | Color of the body for visualization |
[in] | pose | The pose to place the body at |
[in] | body_type | Type of Box2D body, either dynamic, static, or kinematic |
[in] | properties | per-object YAML properties for plugins to reference |
[in] | linear_damping | Box2D body linear damping |
[in] | angular_damping | Box2D body angular damping |
void flatland_server::ModelBody::ConfigFootprintDef | ( | YamlReader & | footprint_reader, |
b2FixtureDef & | fixture_def | ||
) |
Configures the common properties of footprints.
[in] | footprint_reader | YAML reader for node containing the footprint parameters |
[out] | fixture_def | Box2D fixture definition |
const CollisionFilterRegistry * flatland_server::ModelBody::GetCfr | ( | ) | const |
void flatland_server::ModelBody::LoadCircleFootprint | ( | YamlReader & | footprint_reader | ) |
Loads a circle footprint.
[in] | footprint_reader | YAML reader for node containing the footprint parameters |
void flatland_server::ModelBody::LoadFootprints | ( | YamlReader & | footprints_reader | ) |
Load footprints (Box2D fixtures) into the body.
[in] | footprints_reader | YAML reader for node containing the footprints parameters |
void flatland_server::ModelBody::LoadPolygonFootprint | ( | YamlReader & | footprint_reader | ) |
Loads a circle footprint.
[in] | footprint_reader | YAML reader for node containing the footprint parameters |
|
static |
Factory method to create a model body.
[in] | physics_world | Box2D physics world |
[in] | cfr | Collision filter registry |
[in] | model | The model this model body belongs to |
[in] | body_node | YAML reader for node containing the body parameters |