2 #include <argos3/core/simulator/entity/composable_entity.h>
19 bool bIsStatic = cpBodyIsStatic(m_ptBody);
21 cpShape* ptCurShape = m_ptBody->shapeList;
24 ptNextShape = ptCurShape->next;
26 cpShapeFree(ptCurShape);
27 ptCurShape = ptNextShape;
43 m_ptBody->p = cpv(c_position.
GetX(), c_position.
GetY());
46 cpBodySetAngle(m_ptBody, cZAngle.GetValue());
48 if(cpBodyIsStatic(m_ptBody)) {
49 cpBB tBoundingBox = cpShapeGetBB(m_ptBody->shapeList);
51 tBoundingBox = cpShapeGetBB(m_ptBody->shapeList);
65 if(cpBodyIsStatic(m_ptBody))
return;
68 m_ptBody->p = cpv(cPosition.
GetX(), cPosition.
GetY());
72 cpBodySetAngle(m_ptBody, cZAngle.GetValue());
74 m_ptBody->v = cpvzero;
76 cpBodyResetForces(m_ptBody);
86 cpBB tBoundingBox = cpShapeGetBB(m_ptBody->shapeList);
87 for(cpShape* pt_shape = m_ptBody->shapeList->next;
89 pt_shape = pt_shape->next) {
90 cpBB* ptBB = &pt_shape->bb;
91 if(ptBB->l < tBoundingBox.l) tBoundingBox.l = ptBB->l;
92 if(ptBB->b < tBoundingBox.b) tBoundingBox.b = ptBB->b;
93 if(ptBB->r > tBoundingBox.r) tBoundingBox.r = ptBB->r;
94 if(ptBB->t > tBoundingBox.t) tBoundingBox.t = ptBB->t;
107 if(!cpBodyIsStatic(m_ptBody)) {
116 for(cpShape* pt_shape = m_ptBody->shapeList;
118 pt_shape = pt_shape->next) {
119 if(cpSpaceShapeQuery(
120 const_cast<CDynamics2DSingleBodyObjectModel*>(
this)->
122 pt_shape, NULL, NULL) > 0) {
136 m_ptBody->data =
this;
virtual void MoveTo(const CVector3 &c_position, const CQuaternion &c_orientation)
float Real
Collects all ARGoS code.
Real GetX() const
Returns the x coordinate of this vector.
Real GetY() const
Returns the y coordinate of this vector.
virtual void SetBody(cpBody *pt_body, Real f_height)
Sets the body and registers the default origin anchor method.
CQuaternion Orientation
The orientation of the anchor wrt the global coordinate system.
This entity is a link to a body in the physics engine.
It defines the basic type CRadians, used to store an angle value in radians.
virtual void CalculateBoundingBox()
Calculates the axis-aligned box that contains the entire physics model.
virtual void UpdateEntityStatus()
Updates the status of the associated entity.
Basic class for an entity that contains other entities.
void RegisterAnchorMethod(const SAnchor &s_anchor, void(MODEL::*pt_method)(SAnchor &))
Registers an anchor method.
void UpdateOriginAnchor(SAnchor &s_anchor)
Updates the origin anchor associated to the embodied entity.
CQuaternion & FromAngleAxis(const CRadians &c_angle, const CVector3 &c_vector)
void SetX(const Real f_x)
Sets the x coordinate of this vector.
An anchor related to the body of an entity.
virtual bool IsCollidingWithSomething() const
Returns true if this model is colliding with another model.
CDynamics2DEngine & GetDynamics2DEngine()
Returns the dynamics 2D engine state.
void ToEulerAngles(CRadians &c_z_angle, CRadians &c_y_angle, CRadians &c_x_angle) const
CEmbodiedEntity & GetEmbodiedEntity()
Returns the embodied entity associated to this physics model.
static const CVector3 Z
The z axis.
void SetY(const Real f_y)
Sets the y coordinate of this vector.
The base class for models in the dynamics 2D engine.
const SBoundingBox & GetBoundingBox() const
Returns an axis-aligned box that contains the physics model.
CVector3 Position
The position of the anchor wrt the global coordinate system.
The namespace containing all the ARGoS related code.
void SetZ(const Real f_z)
Sets the z coordinate of this vector.
CDynamics2DSingleBodyObjectModel(CDynamics2DEngine &c_engine, CComposableEntity &c_entity)
Class constructor.
virtual ~CDynamics2DSingleBodyObjectModel()
Class destructor.
virtual void UpdateEntityStatus()
Updates the status of the associated entity.
const SAnchor & GetOriginAnchor() const
Returns a const reference to the origin anchor associated to this entity.