 |
AGX Dynamics
2.38.0.2
|
Go to the documentation of this file.
17 #ifndef AGX_RIGIDBODY_H
18 #define AGX_RIGIDBODY_H
35 # pragma warning(push)
36 # pragma warning(disable:4355) //Disable 'this' : used in base member initializer list warning
88 RigidBody *clone(
bool shallowCopyRenderData=
false )
const;
131 void setLocalPosition(
const agx::Vec3& p );
168 void setLocalRotation(
const agx::Quat& q );
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;
390 agx::
Vec3 getLastForce() const;
399 agx::
Vec3 getLastTorque() const;
416 bool hasPropertyContainer() const;
427 const
agx::
Name& getName() const;
433 void setName( const
agx::
Name& name );
468 void setCmTransform( const
agx::
AffineMatrix4x4& matrix,
bool synchronizeModel = true );
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;
507 void setCmRotation( const
agx::
Quat& q);
572 bool removeAttachment( const
agx::
String& name );
598 void setForce( const
agx::
Vec3& force );
616 void setTorque( const
agx::
Vec3& torque );
632 void addForce( const
agx::
Vec3& force );
647 void addForceAtPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
663 void addForceAtLocalPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
679 void addForceAtLocalCmPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
694 void addTorque( const
agx::
Vec3& torque );
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();
836 void updateMassProperties(
agx::
UInt32 mask );
844 agx::
Real calculateMass() const;
859 void setLinearVelocityZeroDamping( const
agx::
Vec3f& dir );
866 void setAngularVelocityZeroDamping( const
agx::
Vec3f& dir );
872 agx::
Vec3f getLinearVelocityZeroDamping() const;
878 agx::
Vec3f getAngularVelocityZeroDamping() const;
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 );
922 agx::
Vec3f getLinearVelocityDamping() const;
927 agx::
Vec3f getAngularVelocityDamping() const;
932 agx::
Vec3 getLinearMomentum() const;
937 agx::
Vec3 getAngularMomentum() const;
945 void setHandleAsParticle(
bool handleAsParticle );
950 bool getHandleAsParticle() const;
956 agx::
Vec3 getAcceleration() const;
962 agx::
Vec3 getAngularAcceleration() const;
970 bool hasConstraints() const;
1007 void setEntity(
agx::Physics::RigidBodyPtr entity );
1013 void transfer(
agxData::EntityStorage* storage );
1028 bool isPowerlineBody() const;
1033 void setIsPowerlineBody(
bool isHydraulicBody);
1036 inline static bool shouldIgnoreGravity(agx::RigidBodyState state)
1039 return !state.enabled() ||
1049 bool hasValidEntityIndex()
const;
1053 friend class GeometryListener;
1086 void incrementNumConstraints();
1087 void decrementNumConstraints();
1088 void resetNumConstraints();
1090 void removeAllGeometries();
1123 FrameTable m_namedAttachments;
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) );
1328 return m_entity.state().powerline();
1333 m_entity.state().setPowerline(isHydraulicBody);
1339 # pragma warning(pop)
const agx::MassProperties * getMassProperties() const
agx::Vec3 getPosition() const
Current model frame position, given in world coordinate frame.
bool hasConstraints() const
agx::UInt32 getId() const
Internal method.
agx::Referenced * getCustomData() const
void setVelocity(const agx::Vec3 &velocity)
Set the linear velocity of the center of mass of this rigid body.
Specialized types of matrices for holding orthogonal transformation matrices.
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
The rigid body class, combining a geometric model and a frame of reference.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
void addForceAtPosition(const agx::Vec3 &force, const agx::Vec3 &position)
Add a force, given in the World coordinate frame, applied at a point specified in world coordinate fr...
agx::SetVector< ref_ptr< RigidBody > > RigidBodyRefSetVector
agx::Quat getCmRotation() const
#define DOXYGEN_END_INTERNAL_BLOCK()
const agx::AffineMatrix4x4 & getCmTransform() const
Convenience methods for center of mass frame.
agx::Quat getRotation() const
Current model frame rotation, given in world coordinate frame.
#define DOXYGEN_START_INTERNAL_BLOCK()
agx::RigidBody::MotionControl getMotionControl() const
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Pointer to a entity instance of type Physics.RigidBody.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool hasPropertyContainer() const
#define AGXPHYSICS_EXPORT
Contains classes for low level data storage for AGX.
Class that is a container of named properties.
Internal data for any object, ObjT, with methods: agx::Referenced* ObjT::getInternalData() const; voi...
const agx::AffineMatrix4x4 & getTransform() const
Current model frame transform, given in world coordinate frame.
agx::Vec3 getCmPosition() const
#define AGX_DECLARE_VECTOR_TYPES(type)
agx::Vec3 getAngularVelocity() const
Angular velocity in world coordinate frame.
void addForce(const agx::Vec3 &force)
Add the specified force, given in world coordinate frame, that will be affecting this body in the nex...
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
void addForceAtLocalCmPosition(const agx::Vec3 &force, const agx::Vec3 &position)
Add a force given in world coordinate frame, applied at a point specified in the local Center of Mass...
agx::UInt16 getNumConstraints() const
AGXPHYSICS_EXPORT void setMotionControl(agx::RigidBodyPtrVector &bodies, agx::RigidBody::MotionControl motionControl)
Utility function to set motion control for a vector of rigid bodies.
Class for rigid body inertia tensor and mass.
agx::Vec3 getCmLocalTranslate() const
agx::Frame * getCmFrame()
Return the center of mass (CM) frame of this rigid body.
Inheritance with partial specialization due to bug with ref_ptr containers.
The geometry representation used by the collision detection engine.
Representation of a name string.
agx::Vec3 getAngularAcceleration() const
Will always be 0 for KINEMATIC and STATIC bodies.
Specialized type of matrices for holding symmetric positive definite matrices.
This class provides conversion services between Euler angles in any of the 24 conventions and corresp...
void addForceAtLocalPosition(const agx::Vec3 &force, const agx::Vec3 &position)
Add a force, given in the world coordinate frame, applied at a point specified in the local Model coo...
void setTorque(const agx::Vec3 &torque)
Explicitly set the torque, given in world coordinate frame, that will be affecting this body in the n...
Pointer to a entity instance of type Physics.Geometry.
void setForce(const agx::Vec3 &force)
Explicitly set the force, given in world coordinate frame, that will be affecting this body in the ne...
bool getHandleAsParticle() const
Base class providing referencing counted objects.
#define AGX_DECLARE_POINTER_TYPES(type)
void setIsPowerlineBody(bool isHydraulicBody)
Internal method.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
@ DYNAMICS
This body moves from the influence of forces.
bool isPowerlineBody() const
#define CALLABLE_UNIT(param)
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.
agx::Frame * getFrame()
Returns the model frame containing model the transformation and utilities to manipulate position,...
void setAngularVelocity(const agx::Vec3 &angularVelocity)
Set the angular velocity of the center of mass of this rigid body.
void getRotate(T &angle, T &x, T &y, T &z) const
Get the angle and vector components represented by the quaternion.
The complete physical system with bodies, interactions, data layout, time stepper,...
void addLocalTorque(agx::Real tx, agx::Real ty, agx::Real tz)
Adds the specified torque, given in Center of Mass coordinate frame that will be affecting this body ...
bool isEnabled() const
Access the state enable flag.
void addTorque(const agx::Vec3 &torque)
Adds the specified torque, given in world coordinate frame, that will be affecting this body in the n...
agx::Physics::RigidBodyPtr getEntity() const
Internal method.
The object defining a frame of reference and providing transformations operations.
agx::Vector< agx::ref_ptr< Geometry > > GeometryRefVector
agx::Vec3 getVelocity() const
Velocity of center of mass frame origin, in world coordinate frame.
agx::PropertyContainer * getPropertyContainer() const
Access property container of this rigid body.
agx::Vec3 getAcceleration() const
Will always be 0 for KINEMATIC and STATIC bodies.
AGXCORE_EXPORT EntityModel * getEntity(const agx::Path &path)
Get a entity with a specified path.