17#ifndef AGX_RIGIDBODY_H
18#define AGX_RIGIDBODY_H
36# pragma warning(disable:4355)
264 void setVelocity( const
agx::
Vec3& velocity );
290 void setAngularVelocity( const
agx::
Vec3& angularVelocity );
318 agx::
Vec3 getAngularVelocity() const;
345 void setEnable(
bool enable );
351 bool getEnable() const;
357 bool isEnabled() const;
416 bool hasPropertyContainer() const;
473 agx::
Vec3 getCmLocalTranslate() const;
479 void setCmLocalTranslate(const
agx::
Vec3& translate);
484 agx::
Vec3 getCmPosition() const;
492 void setCmPosition( const
agx::
Vec3& p,
bool synchronizeModel = true );
497 agx::
Quat getCmRotation() const;
663 void addForceAtLocalPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
679 void addForceAtLocalCmPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
715 void addLocalTorque( const
agx::
Vec3& torque );
761 bool add(
agxCollide::Geometry* geometry,
bool incrementalMassCalculation = false );
773 bool remove(
agxCollide::Geometry* geometry,
bool incrementalMassCalculation = false );
824 void updateMassProperties();
859 void setLinearVelocityZeroDamping( const
agx::
Vec3f& dir );
866 void setAngularVelocityZeroDamping( const
agx::
Vec3f& dir );
886 void setLinearVelocityDamping(
float damping );
894 void setLinearVelocityDamping( const
agx::
Vec3f& damping );
902 void setAngularVelocityDamping(
float damping );
910 void setAngularVelocityDamping( const
agx::
Vec3f& damping );
917 void setVelocityDamping(
float damping );
945 void setHandleAsParticle(
bool handleAsParticle );
950 bool getHandleAsParticle() const;
956 agx::
Vec3 getAcceleration() const;
962 agx::
Vec3 getAngularAcceleration() const;
970 bool hasConstraints() const;
1001 agx::Physics::RigidBodyPtr getEntity() const;
1007 void setEntity(
agx::Physics::RigidBodyPtr entity );
1028 bool isPowerlineBody() const;
1033 void setIsPowerlineBody(
bool isHydraulicBody);
1039 return !state.enabled() ||
1053 friend class GeometryListener;
1086 void incrementNumConstraints();
1087 void decrementNumConstraints();
1088 void resetNumConstraints();
1090 void removeAllGeometries();
1131 return m_entity.state().enabled();
1136 return m_entity.state().enabled();
1146 return ( m_propertyContainer.isValid() );
1151 if ( m_propertyContainer ==
nullptr )
1153 return m_propertyContainer;
1163 return m_entity.id();
1168 return m_frame.get();
1173 return m_frame.get();
1178 return m_cmFrame.get();
1183 return m_cmFrame.get();
1188 return m_entity.cmTransform();
1193 return m_entity.velocity();
1198 return m_entity.angularVelocity();
1203 return getCmFrame()->getLocalTranslate();
1208 return getCmTransform().getTranslate();
1218 return &m_massProperties;
1223 return &m_massProperties;
1228 return m_entity.state().handleAsParticle();
1233 return m_entity.linearAcceleration();
1238 return m_entity.angularAcceleration();
1243 return m_entity.numConstraints() > 0;
1248 return m_entity.numConstraints();
1253 return m_customData.get();
1258 return m_entity.modelTransform();
1263 return m_entity.modelTransform().getTranslate();
1268 return m_entity.modelTransform().
getRotate();
1271 inline Referenced* RigidBody::getInternalData()
const
1273 return m_internalData;
1283 setAngularVelocity(
agx::Vec3(vx,vy,vz));
1313 addLocalTorque(
agx::Vec3(tx, ty, tz) );
1326 inline bool RigidBody::isPowerlineBody()
const
1328 return m_entity.state().powerline();
1331 inline void RigidBody::setIsPowerlineBody(
bool isHydraulicBody)
1333 m_entity.state().setPowerline(isHydraulicBody);
1339# 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.