17#ifndef AGX_RIGIDBODY_H
18#define AGX_RIGIDBODY_H
33# pragma warning(disable:4355)
261 void setVelocity( const
agx::
Vec3& velocity );
287 void setAngularVelocity( const
agx::
Vec3& angularVelocity );
315 agx::
Vec3 getAngularVelocity() const;
342 void setEnable(
bool enable );
348 bool getEnable() const;
354 bool isEnabled() const;
413 bool hasPropertyContainer() const;
470 agx::
Vec3 getCmLocalTranslate() const;
476 void setCmLocalTranslate(const
agx::
Vec3& translate);
481 agx::
Vec3 getCmPosition() const;
489 void setCmPosition( const
agx::
Vec3& p,
bool synchronizeModel = true );
494 agx::
Quat getCmRotation() const;
660 void addForceAtLocalPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
676 void addForceAtLocalCmPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
712 void addLocalTorque( const
agx::
Vec3& torque );
758 bool add(
agxCollide::Geometry* geometry,
bool incrementalMassCalculation = false );
770 bool remove(
agxCollide::Geometry* geometry,
bool incrementalMassCalculation = false );
821 void updateMassProperties();
856 void setLinearVelocityZeroDamping( const
agx::
Vec3f& dir );
863 void setAngularVelocityZeroDamping( const
agx::
Vec3f& dir );
883 void setLinearVelocityDamping(
float damping );
891 void setLinearVelocityDamping( const
agx::
Vec3f& damping );
899 void setAngularVelocityDamping(
float damping );
907 void setAngularVelocityDamping( const
agx::
Vec3f& damping );
914 void setVelocityDamping(
float damping );
942 void setHandleAsParticle(
bool handleAsParticle );
947 bool getHandleAsParticle() const;
953 agx::
Vec3 getAcceleration() const;
959 agx::
Vec3 getAngularAcceleration() const;
967 bool hasConstraints() const;
998 agx::Physics::RigidBodyPtr getEntity() const;
1004 void setEntity(
agx::Physics::RigidBodyPtr entity );
1025 bool isPowerlineBody() const;
1030 void setIsPowerlineBody(
bool isHydraulicBody);
1036 return !state.enabled() ||
1050 friend class GeometryListener;
1083 void incrementNumConstraints();
1084 void decrementNumConstraints();
1085 void resetNumConstraints();
1087 void removeAllGeometries();
1128 return m_entity.state().enabled();
1133 return m_entity.state().enabled();
1143 return ( m_propertyContainer.isValid() );
1148 if ( m_propertyContainer ==
nullptr )
1150 return m_propertyContainer;
1160 return m_entity.id();
1165 return m_frame.get();
1170 return m_frame.get();
1175 return m_cmFrame.get();
1180 return m_cmFrame.get();
1185 return m_entity.cmTransform();
1190 return m_entity.velocity();
1195 return m_entity.angularVelocity();
1200 return getCmFrame()->getLocalTranslate();
1205 return getCmTransform().getTranslate();
1215 return &m_massProperties;
1220 return &m_massProperties;
1225 return m_entity.state().handleAsParticle();
1230 return m_entity.linearAcceleration();
1235 return m_entity.angularAcceleration();
1240 return m_entity.numConstraints() > 0;
1245 return m_entity.numConstraints();
1250 return m_customData.get();
1255 return m_entity.modelTransform();
1260 return m_entity.modelTransform().getTranslate();
1265 return m_entity.modelTransform().
getRotate();
1268 inline Referenced* RigidBody::getInternalData()
const
1270 return m_internalData;
1280 setAngularVelocity(
agx::Vec3(vx,vy,vz));
1310 addLocalTorque(
agx::Vec3(tx, ty, tz) );
1323 inline bool RigidBody::isPowerlineBody()
const
1325 return m_entity.state().powerline();
1328 inline void RigidBody::setIsPowerlineBody(
bool isHydraulicBody)
1330 m_entity.state().setPowerline(isHydraulicBody);
1336# pragma warning(pop)
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
The geometry representation used by the collision detection engine.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
The complete physical system with bodies, interactions, data layout, time stepper,...
This class provides conversion services between Euler angles in any of the 24 conventions and corresp...
The object defining a frame of reference and providing transformations operations.
Internal data for any object, ObjT, with methods: agx::Referenced* ObjT::getInternalData() const; voi...
Inheritance with partial specialization due to bug with ref_ptr containers.
Class for rigid body inertia tensor and mass.
Representation of a name string.
Specialized types of matrices for holding orthogonal transformation matrices.
Pointer to a entity instance of type Physics.Geometry.
Pointer to a entity instance of type Physics.RigidBody.
Class that is a container of named properties.
void getRotate(T &angle, T &x, T &y, T &z) const
Get the angle and vector components represented by the quaternion.
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
@ DYNAMICS
This body moves from the influence of forces.
void setLocalPosition(agx::Real x, agx::Real y, agx::Real z)
Set the position of the body relative to its model frame's parent frame.
void setLocalRotation(const agx::Quat &q)
Set the rotation of the body relative to its model frame's parent frame.
bool hasValidEntityIndex() const
void setLocalTransform(const agx::AffineMatrix4x4 &matrix)
Assign the local transformation matrix for this body, ignoring any eventual parent transformation.
void setPosition(agx::Real x, agx::Real y, agx::Real z)
Set the position of the model frame in world coordinates.
const agx::AffineMatrix4x4 & getLocalTransform() const
void setRotation(const agx::Quat &q)
Set the rotation of the body relative to world frame.
void setSystem(agx::DynamicsSystem *system)
Assign dynamics system where this body belongs to.
const agx::Frame * getParentFrame() const
void incrementalMassPropertyUpdate(agx::UInt32 mask, int sign, const agxCollide::Geometry *geometry)
Will calculate new mass properties for this rigid body as the previously calculated one +/- the speci...
RigidBody(agxCollide::Geometry *geometry)
Construct given geometry.
void setTransform(const agx::AffineMatrix4x4 &matrix)
Set the transform of the body.
agx::Frame * getParentFrame()
RigidBody * clone(bool shallowCopyRenderData=false) const
Create a clone of the rigid body.
void setRotation(const agx::OrthoMatrix3x3 &m)
Set the rotation of the body relative to world frame.
RigidBody(const agx::Name &name, agx::Physics::RigidBodyPtr entity)
bool setParentFrame(agx::Frame *frame)
Set the parent frame of this body's model frame.
void setPosition(const agx::Vec3 &p)
Set the position of the model frame in world coordinates.
void setRotation(const agx::EulerAngles &e)
Set the rotation of the body relative to world frame.
void setId(agx::UInt32 id)
Assign dynamics system unique id to this rigid body.
RigidBody(const agx::Name &name="")
Construct given name.
void setLocalPosition(const agx::Vec3 &p)
Set the position of the body relative to its model frame's parent frame.
static bool shouldIgnoreGravity(agx::RigidBodyState state)
void setLocalRotation(const agx::EulerAngles &e)
Set the rotation of the body relative to its model frame's parent frame.
RigidBody(const agx::RigidBody &)
agx::Vec3 getLocalPosition() const
agx::Quat getLocalRotation() const
Specialized type of matrices for holding symmetric positive definite matrices.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
#define CALLABLE_UNIT(param)
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Contains classes for low level data storage for AGX.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::SetVector< ref_ptr< RigidBody > > RigidBodyRefSetVector
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.