 |
AGXDynamics
2.35.0.3
|
Go to the documentation of this file.
17 #ifndef AGX_RIGIDBODY_H
18 #define AGX_RIGIDBODY_H
36 # pragma warning(push)
37 # pragma warning(disable:4355) //Disable 'this' : used in base member initializer list warning
44 class MergeSplitBodyStorage;
91 RigidBody *clone(
bool shallowCopyRenderData=
false )
const;
134 void setLocalPosition(
const agx::Vec3& p );
171 void setLocalRotation(
const agx::Quat& q );
267 void setVelocity( const
agx::
Vec3& velocity );
293 void setAngularVelocity( const
agx::
Vec3& angularVelocity );
321 agx::
Vec3 getAngularVelocity() const;
348 void setEnable(
bool enable );
354 bool getEnable() const;
360 bool isEnabled() const;
393 agx::
Vec3 getLastForce() const;
402 agx::
Vec3 getLastTorque() const;
419 bool hasPropertyContainer() const;
430 const
agx::
Name& getName() const;
436 void setName( const
agx::
Name& name );
517 void setCmTransform( const
agx::
AffineMatrix4x4& matrix,
bool synchronizeModel = true );
522 agx::
Vec3 getCmLocalTranslate() const;
528 void setCmLocalTranslate(const
agx::
Vec3& translate);
533 agx::
Vec3 getCmPosition() const;
541 void setCmPosition( const
agx::
Vec3& p,
bool synchronizeModel = true );
546 agx::
Quat getCmRotation() const;
556 void setCmRotation( const
agx::
Quat& q);
621 bool removeAttachment( const
agx::
String& name );
647 void setForce( const
agx::
Vec3& force );
665 void setTorque( const
agx::
Vec3& torque );
681 void addForce( const
agx::
Vec3& force );
696 void addForceAtPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
712 void addForceAtLocalPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
728 void addForceAtLocalCmPosition( const
agx::
Vec3& force, const
agx::
Vec3& position );
743 void addTorque( const
agx::
Vec3& torque );
764 void addLocalTorque( const
agx::
Vec3& torque );
810 bool add(
agxCollide::Geometry* geometry,
bool incrementalMassCalculation = false );
822 bool remove(
agxCollide::Geometry* geometry,
bool incrementalMassCalculation = false );
879 void updateMassProperties();
891 void updateMassProperties(
agx::
UInt32 mask );
899 agx::
Real calculateMass() const;
914 void setLinearVelocityZeroDamping( const
agx::
Vec3f& dir );
921 void setAngularVelocityZeroDamping( const
agx::
Vec3f& dir );
927 agx::
Vec3f getLinearVelocityZeroDamping() const;
933 agx::
Vec3f getAngularVelocityZeroDamping() const;
941 void setLinearVelocityDamping(
float damping );
949 void setLinearVelocityDamping( const
agx::
Vec3f& damping );
957 void setAngularVelocityDamping(
float damping );
965 void setAngularVelocityDamping( const
agx::
Vec3f& damping );
972 void setVelocityDamping(
float damping );
977 agx::
Vec3f getLinearVelocityDamping() const;
982 agx::
Vec3f getAngularVelocityDamping() const;
987 agx::
Vec3 getLinearMomentum() const;
992 agx::
Vec3 getAngularMomentum() const;
998 agx::
Real getPotentialEnergy() const;
1004 agx::
Real getTranslationalEnergy() const;
1010 agx::
Real getRotationalEnergy() const;
1016 agx::
Real getTotalEnergy() const;
1024 void setHandleAsParticle(
bool handleAsParticle );
1029 bool getHandleAsParticle() const;
1035 agx::
Vec3 getAcceleration() const;
1041 agx::
Vec3 getAngularAcceleration() const;
1049 bool hasConstraints() const;
1086 void setEntity(
agx::Physics::RigidBodyPtr entity );
1092 void transfer(
agxData::EntityStorage* storage );
1121 bool hasBodyStorage() const;
1126 bool isPowerlineBody() const;
1131 void setIsPowerlineBody(
bool isHydraulicBody);
1147 bool isMerged() const;
1150 inline static bool shouldIgnoreGravity(agx::RigidBodyState state)
1153 return !state.enabled() ||
1176 void setEnableMerge(
bool flag );
1181 bool getEnableMerge()
const;
1187 void setEnableSplit(
bool flag );
1192 bool getEnableSplit()
const;
1198 void setMergeOnlyWithStatic(
bool flag );
1203 bool getMergeOnlyWithStatic()
const;
1210 ENABLE_MERGE_WITH_STATIC,
1251 void setSleeping(
bool flag );
1256 State getState()
const;
1261 bool isSleeping( )
const;
1268 void setEnable(
bool flag );
1273 bool getEnable( )
const;
1278 float getRestTime()
const;
1296 void setSleeping(
bool flag,
State state );
1302 void setState(
State state );
1309 void setRestTime(
float t );
1326 bool hasValidEntityIndex()
const;
1330 friend class GeometryListener;
1364 void clearBodyStorage();
1377 void incrementNumConstraints();
1378 void decrementNumConstraints();
1379 void resetNumConstraints();
1381 void removeAllGeometries();
1417 FrameTable m_namedAttachments;
1423 MergeSplitProperties m_msProperties;
1424 AutoSleepProperties m_autoSleepProperties;
1429 return m_entity.state().enabled();
1434 return m_entity.state().enabled();
1444 return ( m_propertyContainer.isValid() );
1449 if ( m_propertyContainer ==
nullptr )
1451 return m_propertyContainer;
1461 return m_entity.id();
1466 return m_autoSleepThreshold;
1471 return m_autoSleepThreshold;
1476 return m_mergeSplitThreshold;
1481 return m_mergeSplitThreshold;
1486 return m_frame.get();
1491 return m_frame.get();
1496 return m_cmFrame.get();
1501 return m_cmFrame.get();
1506 return m_entity.cmTransform();
1511 return m_entity.velocity();
1516 return m_entity.angularVelocity();
1521 return getCmFrame()->getLocalTranslate();
1526 return getCmTransform().getTranslate();
1536 return &m_massProperties;
1541 return &m_massProperties;
1546 return m_entity.state().handleAsParticle();
1551 return m_flags[ENABLE_MERGE];
1556 return m_flags[ENABLE_SPLIT];
1561 return m_flags[ENABLE_MERGE_WITH_STATIC];
1566 return m_msProperties;
1571 return m_msProperties;
1576 return (
State)m_state;
1586 return getState() == ASLEEP;
1594 AGX_FORCE_INLINE void RigidBody::AutoSleepProperties::setRestTime(
float t )
1601 return m_autoSleepProperties;
1605 return m_autoSleepProperties;
1610 return m_entity.linearAcceleration();
1615 return m_entity.angularAcceleration();
1620 return m_entity.numConstraints() > 0;
1625 return m_entity.numConstraints();
1630 return m_customData.get();
1635 return m_entity.modelTransform();
1640 return m_entity.modelTransform().getTranslate();
1645 return m_entity.modelTransform().
getRotate();
1648 inline Referenced* RigidBody::getInternalData()
const
1650 return m_internalData;
1660 setAngularVelocity(
agx::Vec3(vx,vy,vz));
1690 addLocalTorque(
agx::Vec3(tx, ty, tz) );
1705 return m_entity.state().powerline();
1710 m_entity.state().setPowerline(isHydraulicBody);
1716 # 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...
#define AGX_DEPRECATED(since)
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
State
Specifies the state of auto sleep for this body.
#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...
Book keeping of a body which can be merged with other bodies.
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::MergeSplitThreshold * getMergeSplitThreshold()
Returns custom merge-split parameters for this rigid body.
bool getEnableSplit() const
agx::Frame * getCmFrame()
Return the center of mass (CM) frame of this rigid body.
agx::RigidBody::AutoSleepProperties & getAutoSleepProperties()
Inheritance with partial specialization due to bug with ref_ptr containers.
The geometry representation used by the collision detection engine.
float getRestTime() const
Class which will go through contacting/separating bodies and determine if the bodies can be merged (g...
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...
bool getMergeOnlyWithStatic() const
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
bool getEnableMerge() const
Base class providing referencing counted objects.
#define AGX_DECLARE_POINTER_TYPES(type)
void setIsPowerlineBody(bool isHydraulicBody)
Internal method.
Data holder for auto-sleep properties.
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
agx::AutoSleepThreshold * getAutoSleepThreshold()
Returns custom auto-sleep parameters for this rigid body.
#define CALLABLE_UNIT(param)
agx::RigidBody::MergeSplitProperties & getMergeSplitProperties()
void AGXPHYSICS_EXPORT init()
Initialize agx.
agx::Frame * getFrame()
Returns the model frame containing model the transformation and utilities to manipulate position,...
Data holder for merge-split properties.
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.
Class that will investigate bodies to see if they are resting, that is if linear/angular velocity and...
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.