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(
122 pt_shape,
nullptr,
nullptr) > 0) {
136 m_ptBody->data =
this;
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
Basic class for an entity that contains other entities.
This entity is a link to a body in the physics engine.
const SAnchor & GetOriginAnchor() const
Returns a const reference to the origin anchor associated to this entity.
An anchor related to the body of an entity.
CQuaternion Orientation
The orientation of the anchor wrt the global coordinate system.
CVector3 Position
The position of the anchor wrt the global coordinate system.
void RegisterAnchorMethod(const SAnchor &s_anchor, void(MODEL::*pt_method)(SAnchor &))
Registers an anchor method.
CEmbodiedEntity & GetEmbodiedEntity()
Returns the embodied entity associated to this physics model.
const SBoundingBox & GetBoundingBox() const
Returns an axis-aligned box that contains the physics model.
virtual void UpdateEntityStatus()
Updates the status of the associated entity.
It defines the basic type CRadians, used to store an angle value in radians.
Real GetValue() const
Returns the value in radians.
void ToEulerAngles(CRadians &c_z_angle, CRadians &c_y_angle, CRadians &c_x_angle) const
CQuaternion & FromAngleAxis(const CRadians &c_angle, const CVector3 &c_vector)
void SetY(const Real f_y)
Sets the y coordinate of this vector.
Real GetX() const
Returns the x coordinate of this vector.
void SetX(const Real f_x)
Sets the x coordinate of this vector.
void SetZ(const Real f_z)
Sets the z coordinate of this vector.
Real GetY() const
Returns the y coordinate of this vector.
static const CVector3 Z
The z axis.
The base class for models in the dynamics 2D engine.
CDynamics2DEngine & GetDynamics2DEngine()
Returns the dynamics 2D engine state.
Base class for object models with a single body.
CDynamics2DSingleBodyObjectModel(CDynamics2DEngine &c_engine, CComposableEntity &c_entity)
Class constructor.
virtual void MoveTo(const CVector3 &c_position, const CQuaternion &c_orientation)
virtual void UpdateEntityStatus()
Updates the status of the associated entity.
virtual ~CDynamics2DSingleBodyObjectModel()
Class destructor.
void UpdateOriginAnchor(SAnchor &s_anchor)
Updates the origin anchor associated to the embodied entity.
virtual void SetBody(cpBody *pt_body, Real f_height)
Sets the body and registers the default origin anchor method.
virtual bool IsCollidingWithSomething() const
Returns true if this model is colliding with another model.
virtual void CalculateBoundingBox()
Calculates the axis-aligned box that contains the entire physics model.