AGX Dynamics  2.37.3.2
RigidBody.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_RIGIDBODY_H
18 #define AGX_RIGIDBODY_H
19 
20 #include <agx/agx.h>
21 #include <agx/Frame.h>
22 #include <agx/MassProperties.h>
23 #include <agx/BitArray.h>
24 
26 
27 #include <agxCollide/Geometry.h>
28 
29 #include <agx/SleepThreshold.h>
30 #include <agx/RigidBodyState.h>
31 #include <agx/SetVector.h>
32 
33 #include <agx/macros.h>
34 
35 #ifdef _MSC_VER
36 # pragma warning(push)
37 # pragma warning(disable:4355) //Disable 'this' : used in base member initializer list warning
38 #endif
39 
40 namespace agx
41 {
42  class DynamicsSystem;
43  class AutoSleep;
44  class MergeSplitBodyStorage;
45  class InternalData;
46 
50 
55  {
56  public:
66  {
67  STATIC = 1,
68  KINEMATICS = 2,
69  DYNAMICS = 3
70  };
71 
72  public:
79  RigidBody( const agx::Name& name = "" );
80 
86  RigidBody( agxCollide::Geometry* geometry );
87 
91  RigidBody *clone( bool shallowCopyRenderData=false ) const;
92 
98  agx::Frame* getFrame();
99 
105  const agx::Frame* getFrame() const;
106 
112  void setTransform( const agx::AffineMatrix4x4& matrix );
113 
117  const agx::AffineMatrix4x4& getLocalTransform() const;
118 
123  void setLocalTransform( const agx::AffineMatrix4x4& matrix );
124 
128  agx::Vec3 getLocalPosition() const;
129 
134  void setLocalPosition( const agx::Vec3& p );
135 
142  void setLocalPosition( agx::Real x, agx::Real y, agx::Real z );
143 
148  void setRotation( const agx::Quat& q );
149 
154  void setRotation( const agx::EulerAngles& e);
155 
160  void setRotation( const agx::OrthoMatrix3x3& m );
161 
165  agx::Quat getLocalRotation() const;
166 
171  void setLocalRotation( const agx::Quat& q );
172 
177  void setLocalRotation( const agx::EulerAngles& e );
178 
182  agx::Frame* getParentFrame();
183 
187  const agx::Frame* getParentFrame() const;
188 
201  bool setParentFrame( agx::Frame* frame );
202 
207  void setPosition( const agx::Vec3& p );
208 
215  void setPosition( agx::Real x, agx::Real y, agx::Real z );
216 
225  agx::Frame* getCmFrame();
226 
235  const agx::Frame* getCmFrame() const;
236 
241  const agx::AffineMatrix4x4& getTransform() const;
242 
247  CALLABLE_UNIT("m/s")
248  agx::Vec3 getPosition() const;
249 
254  agx::Quat getRotation() const;
255 
267  void setVelocity( const agx::Vec3& velocity );
268 
280  void setVelocity( agx::Real vx, agx::Real vy, agx::Real vz );
281 
293  void setAngularVelocity( const agx::Vec3& angularVelocity );
294 
306  void setAngularVelocity( agx::Real vx, agx::Real vy, agx::Real vz );
307 
313  agx::Vec3 getVelocity() const;
314 
321  agx::Vec3 getAngularVelocity() const;
322 
331  agx::Vec3 getModelVelocity( const agx::Vec3& relPos = agx::Vec3() ) const;
332 
341  agx::Vec3 getModelAcceleration( const agx::Vec3& relPos = agx::Vec3() ) const;
342 
348  void setEnable( bool enable );
349 
354  bool getEnable() const;
355 
360  bool isEnabled() const;
361 
365  agx::RigidBody::MotionControl getMotionControl() const;
366 
374  void setMotionControl( agx::RigidBody::MotionControl control );
375 
379  agx::DynamicsSystem* getSystem();
380 
384  const agx::DynamicsSystem* getSystem() const;
385 
393  agx::Vec3 getLastForce() const;
394 
402  agx::Vec3 getLastTorque() const;
403 
414  agx::PropertyContainer* getPropertyContainer() const;
415 
419  bool hasPropertyContainer() const;
420 
425  void setPropertyContainer( agx::PropertyContainer* container );
426 
430  const agx::Name& getName() const;
431 
436  void setName( const agx::Name& name );
437 
444  agx::UInt32 getId() const;
445 
452  agx::AutoSleepThreshold* getAutoSleepThreshold();
453 
460  const agx::AutoSleepThreshold* getAutoSleepThreshold() const;
461 
468  void setAutoSleepThreshold( agx::AutoSleepThreshold* threshold );
469 
475  agx::MergeSplitThreshold* getMergeSplitThreshold();
476 
482  const agx::MergeSplitThreshold* getMergeSplitThreshold() const;
483 
490  void setMergeSplitThreshold( agx::MergeSplitThreshold* threshold );
491 
505  const agx::AffineMatrix4x4& getCmTransform() const;
506 
517  void setCmTransform( const agx::AffineMatrix4x4& matrix, bool synchronizeModel = true );
518 
522  agx::Vec3 getCmLocalTranslate() const;
523 
528  void setCmLocalTranslate(const agx::Vec3& translate);
529 
533  agx::Vec3 getCmPosition() const;
534 
541  void setCmPosition( const agx::Vec3& p, bool synchronizeModel = true );
542 
546  agx::Quat getCmRotation() const;
547 
556  void setCmRotation( const agx::Quat& q);
557 
566  void setCmRotation( const agx::EulerAngles& e);
567 
576  void setCmRotation( const agx::OrthoMatrix3x3& m);
577 
592  void setInertiaTensor( const agx::SPDMatrix3x3& inertiaTensor, const agx::AffineMatrix4x4& cmLocalTransform = agx::AffineMatrix4x4(), bool autogenerateCmOffset = false, bool autogenerateInertia = false );
593 
609  void setInertiaTensor( const agx::Vec3& inertiaDiagonal, const agx::AffineMatrix4x4& cmLocalTransform = agx::AffineMatrix4x4(), bool autogenerateCmOffset = false, bool autogenerateInertia = false );
610 
615  bool addAttachment( agx::Frame* frame, const agx::String& name );
616 
621  bool removeAttachment( const agx::String& name );
622 
628  Frame* getAttachment( const agx::String& name );
629 
633  const agx::MassProperties* getMassProperties() const;
634 
638  agx::MassProperties* getMassProperties();
639 
647  void setForce( const agx::Vec3& force );
648 
656  void setForce( agx::Real fx, agx::Real fy, agx::Real fz );
657 
665  void setTorque( const agx::Vec3& torque );
666 
674  void setTorque( agx::Real tx, agx::Real ty, agx::Real tz );
675 
681  void addForce( const agx::Vec3& force );
682 
688  void addForce( agx::Real fx, agx::Real fy, agx::Real fz );
689 
696  void addForceAtPosition( const agx::Vec3& force, const agx::Vec3& position );
697 
704  void addForceAtPosition( agx::Real fx, agx::Real fy, agx::Real fz, agx::Real px, agx::Real py, agx::Real pz );
705 
712  void addForceAtLocalPosition( const agx::Vec3& force, const agx::Vec3& position );
713 
720  void addForceAtLocalPosition( agx::Real fx, agx::Real fy, agx::Real fz, agx::Real px, agx::Real py, agx::Real pz );
721 
728  void addForceAtLocalCmPosition( const agx::Vec3& force, const agx::Vec3& position );
729 
736  void addForceAtLocalCmPosition( agx::Real fx, agx::Real fy, agx::Real fz, agx::Real px, agx::Real py, agx::Real pz );
737 
743  void addTorque( const agx::Vec3& torque );
744 
750  void addTorque( agx::Real tx, agx::Real ty, agx::Real tz );
751 
757  void addLocalTorque( agx::Real tx, agx::Real ty, agx::Real tz );
758 
764  void addLocalTorque( const agx::Vec3& torque );
765 
785  bool add( agxCollide::Geometry* geometry , const agx::AffineMatrix4x4& localTransform, bool incrementalMassCalculation = false );
786 
810  bool add( agxCollide::Geometry* geometry, bool incrementalMassCalculation = false );
811 
822  bool remove( agxCollide::Geometry* geometry, bool incrementalMassCalculation = false );
823 
829  const agxCollide::Geometry* getGeometry(const agx::Name& name) const;
830 
837  agxCollide::Geometry* getGeometry(const agx::Name& name);
838 
842  const agxCollide::GeometryRefVector& getGeometries() const;
843 
848  const agxCollide::GeometryRefVector& getOriginalGeometries() const;
849 
859  void moveTo( const agx::AffineMatrix4x4& target, agx::Real t );
860 
871  void moveTo( const agx::Vec3& targetPosition, const agx::Quat& targetRotation, agx::Real t );
872 
879  void updateMassProperties();
880 
891  void updateMassProperties( agx::UInt32 mask );
892 
899  agx::Real calculateMass() const;
900 
907  agx::Vec3 calculateCenterOfMassOffset( agx::Real mass = agx::Real() ) const;
908 
914  void setLinearVelocityZeroDamping( const agx::Vec3f& dir );
915 
921  void setAngularVelocityZeroDamping( const agx::Vec3f& dir );
922 
927  agx::Vec3f getLinearVelocityZeroDamping() const;
928 
933  agx::Vec3f getAngularVelocityZeroDamping() const;
934 
941  void setLinearVelocityDamping( float damping );
942 
949  void setLinearVelocityDamping( const agx::Vec3f& damping );
950 
957  void setAngularVelocityDamping( float damping );
958 
965  void setAngularVelocityDamping( const agx::Vec3f& damping );
966 
972  void setVelocityDamping( float damping );
973 
977  agx::Vec3f getLinearVelocityDamping() const;
978 
982  agx::Vec3f getAngularVelocityDamping() const;
983 
987  agx::Vec3 getLinearMomentum() const;
988 
992  agx::Vec3 getAngularMomentum() const;
993 
1000  void setHandleAsParticle( bool handleAsParticle );
1001 
1005  bool getHandleAsParticle() const;
1006 
1011  agx::Vec3 getAcceleration() const;
1012 
1017  agx::Vec3 getAngularAcceleration() const;
1018 
1025  bool hasConstraints() const;
1026 
1033  agx::UInt16 getNumConstraints() const;
1034 
1039  agx::Referenced* getCustomData() const;
1040 
1050  void setCustomData( agx::Referenced* data );
1051 
1056  agx::Physics::RigidBodyPtr getEntity() const;
1057 
1062  void setEntity( agx::Physics::RigidBodyPtr entity );
1063 
1068  void transfer( agxData::EntityStorage* storage );
1069 
1073  agx::Vec3 getForce() const;
1074 
1078  agx::Vec3 getTorque() const;
1079 
1085  agx::MergeSplitBodyStorage* getBodyStorage();
1086 
1092  const agx::MergeSplitBodyStorage* getBodyStorage() const;
1093 
1097  bool hasBodyStorage() const;
1098 
1102  bool isPowerlineBody() const;
1103 
1107  void setIsPowerlineBody(bool isHydraulicBody);
1108 
1118  agx::AffineMatrix4x4 getMergedWorldTransform() const;
1119 
1123  bool isMerged() const;
1124 
1125 #ifndef SWIG
1126  inline static bool shouldIgnoreGravity(agx::RigidBodyState state)
1128  {
1129  return !state.enabled() ||
1130  state.motionControl() != agx::RigidBody::DYNAMICS ||
1131  state.powerline();
1132  }
1133 #endif
1134 
1140  {
1141  public:
1147 
1152  void setEnableMerge( bool flag );
1153 
1157  bool getEnableMerge() const;
1158 
1163  void setEnableSplit( bool flag );
1164 
1168  bool getEnableSplit() const;
1169 
1174  void setMergeOnlyWithStatic( bool flag );
1175 
1179  bool getMergeOnlyWithStatic() const;
1180 
1181  private:
1182  enum FLAGS
1183  {
1184  ENABLE_MERGE,
1185  ENABLE_SPLIT,
1186  ENABLE_MERGE_WITH_STATIC,
1187  NUM_ELEMENTS
1188  };
1189 
1191 
1192  private:
1193  FlagVector m_flags;
1194  };
1195 
1199  agx::RigidBody::MergeSplitProperties& getMergeSplitProperties();
1200  const agx::RigidBody::MergeSplitProperties& getMergeSplitProperties() const;
1201 
1206  {
1207  public:
1211  enum State {
1212  AWAKE = 0,
1213  TIRED = 1,
1214  ASLEEP = 2
1215  };
1216 
1227  void setSleeping( bool flag );
1228 
1232  State getState() const;
1233 
1237  bool isSleeping( ) const;
1238 
1244  void setEnable( bool flag );
1245 
1249  bool getEnable( ) const;
1250 
1254  float getRestTime() const;
1255 
1256  protected:
1257  // Never create this outside of a RigidBody.
1258  AutoSleepProperties( RigidBody *body = nullptr );
1259 
1260  private:
1272  void setSleeping( bool flag, State state );
1273 
1278  void setState( State state );
1279 
1280  friend class RigidBody;
1281  friend class AutoSleep;
1283 
1285  void setRestTime( float t );
1286 
1287  private:
1288  float m_restTime;
1289  bool m_enabled;
1290  agx::UInt8 m_state;
1291  RigidBody *m_body;
1292  };
1293 
1297  agx::RigidBody::AutoSleepProperties& getAutoSleepProperties();
1298  const agx::RigidBody::AutoSleepProperties& getAutoSleepProperties() const;
1299 
1301 
1302  bool hasValidEntityIndex() const;
1303 
1304  protected:
1305  friend class DynamicsSystem;
1306  friend class GeometryListener;
1308  friend class MergeSplit;
1310  friend class AutoSleepProperties;
1311 
1312  virtual ~RigidBody();
1313 
1314  // Never use these
1315  RigidBody( const agx::RigidBody& );
1316  RigidBody( const agx::Name& name, agx::Physics::RigidBodyPtr entity );
1317  RigidBody& operator = ( const agx::RigidBody& ) { return *this; }
1318 
1323  void setId( agx::UInt32 id );
1324 
1329  void setSystem( agx::DynamicsSystem* system );
1330 
1335  void setBodyStorage( agx::MergeSplitBodyStorage* bodyStorage );
1336 
1340  void clearBodyStorage();
1341 
1348  void incrementalMassPropertyUpdate( agx::UInt32 mask, int sign, const agxCollide::Geometry* geometry );
1349 
1350  private:
1351  void init( const agx::Name& name );
1352 
1353  void incrementNumConstraints();
1354  void decrementNumConstraints();
1355  void resetNumConstraints();
1356 
1357  void removeAllGeometries();
1358  void appendGeometry( agxCollide::Geometry* geometry );
1359  void removeGeometry( agx::Physics::GeometryPtr before, agx::Physics::GeometryPtr toBeRemoved );
1360 
1362  friend class InternalData;
1366  agx::Referenced* getInternalData() const;
1367 
1371  void setInternalData( agx::Referenced* data );
1373 
1374  private:
1375  // Low level data.
1376  Physics::RigidBodyRef m_entity;
1377 
1378  mutable PropertyContainerRef m_propertyContainer;
1379 
1380  DynamicsSystem* m_mainSystem;
1381 
1382  AutoSleepThresholdRef m_autoSleepThreshold;
1383  MergeSplitThresholdRef m_mergeSplitThreshold;
1384 
1385  FrameRef m_frame;
1386  FrameRef m_cmFrame;
1387 
1388  MassProperties m_massProperties;
1389 
1390  agxCollide::GeometryRefVector m_geometries;
1391 
1393  FrameTable m_namedAttachments;
1394 
1395  agx::ref_ptr<agx::Referenced> m_customData;
1396  agx::ref_ptr<agx::Referenced> m_internalData;
1397 
1398  MergeSplitBodyStorage* m_bodyStorage;
1399  MergeSplitProperties m_msProperties;
1400  AutoSleepProperties m_autoSleepProperties;
1401  };
1402 
1404  {
1405  return m_entity.state().enabled();
1406  }
1407 
1409  {
1410  return m_entity.state().enabled();
1411  }
1412 
1414  {
1415  return (MotionControl)m_entity.state().motionControl();
1416  }
1417 
1419  {
1420  return ( m_propertyContainer.isValid() );
1421  }
1422 
1424  {
1425  if ( m_propertyContainer == nullptr )
1426  m_propertyContainer = new agx::PropertyContainer;
1427  return m_propertyContainer;
1428  }
1429 
1431  {
1432  return m_entity;
1433  }
1434 
1436  {
1437  return m_entity.id();
1438  }
1439 
1441  {
1442  return m_autoSleepThreshold;
1443  }
1444 
1446  {
1447  return m_autoSleepThreshold;
1448  }
1449 
1451  {
1452  return m_mergeSplitThreshold;
1453  }
1454 
1456  {
1457  return m_mergeSplitThreshold;
1458  }
1459 
1461  {
1462  return m_frame.get();
1463  }
1464 
1466  {
1467  return m_frame.get();
1468  }
1469 
1471  {
1472  return m_cmFrame.get();
1473  }
1474 
1476  {
1477  return m_cmFrame.get();
1478  }
1479 
1480  AGX_FORCE_INLINE const AffineMatrix4x4& RigidBody::getCmTransform() const
1481  {
1482  return m_entity.cmTransform();
1483  }
1484 
1486  {
1487  return m_entity.velocity();
1488  }
1489 
1491  {
1492  return m_entity.angularVelocity();
1493  }
1494 
1496  {
1497  return getCmFrame()->getLocalTranslate();
1498  }
1499 
1501  {
1502  return getCmTransform().getTranslate();
1503  }
1504 
1506  {
1507  return getCmTransform().getRotate();
1508  }
1509 
1511  {
1512  return &m_massProperties;
1513  }
1514 
1516  {
1517  return &m_massProperties;
1518  }
1519 
1521  {
1522  return m_entity.state().handleAsParticle();
1523  }
1524 
1526  {
1527  return m_flags[ENABLE_MERGE];
1528  }
1529 
1531  {
1532  return m_flags[ENABLE_SPLIT];
1533  }
1534 
1536  {
1537  return m_flags[ENABLE_MERGE_WITH_STATIC];
1538  }
1539 
1541  {
1542  return m_msProperties;
1543  }
1544 
1546  {
1547  return m_msProperties;
1548  }
1549 
1551  {
1552  return (State)m_state;
1553  }
1554 
1556  {
1557  return m_enabled;
1558  }
1559 
1561  {
1562  return getState() == ASLEEP;
1563  }
1564 
1566  {
1567  return m_restTime;
1568  }
1569 
1570  AGX_FORCE_INLINE void RigidBody::AutoSleepProperties::setRestTime( float t )
1571  {
1572  m_restTime = t;
1573  }
1574 
1576  {
1577  return m_autoSleepProperties;
1578  }
1580  {
1581  return m_autoSleepProperties;
1582  }
1583 
1585  {
1586  return m_entity.linearAcceleration();
1587  }
1588 
1590  {
1591  return m_entity.angularAcceleration();
1592  }
1593 
1595  {
1596  return m_entity.numConstraints() > 0;
1597  }
1598 
1600  {
1601  return m_entity.numConstraints();
1602  }
1603 
1605  {
1606  return m_customData.get();
1607  }
1608 
1610  {
1611  return m_entity.modelTransform();
1612  }
1613 
1615  {
1616  return m_entity.modelTransform().getTranslate();
1617  }
1618 
1620  {
1621  return m_entity.modelTransform().getRotate();
1622  }
1623 
1624  inline Referenced* RigidBody::getInternalData() const
1625  {
1626  return m_internalData;
1627  }
1628 
1630  {
1631  setVelocity(agx::Vec3(vx,vy,vz));
1632  }
1633 
1635  {
1636  setAngularVelocity(agx::Vec3(vx,vy,vz));
1637  }
1638 
1640  {
1641  addForce( agx::Vec3(fx,fy,fz) );
1642  }
1643 
1645  {
1646  addForceAtPosition( agx::Vec3(fx,fy,fz), agx::Vec3(px,py,pz) );
1647  }
1648 
1650  {
1651  addForceAtLocalPosition( agx::Vec3(fx,fy,fz), agx::Vec3(px,py,pz) );
1652  }
1653 
1655  {
1656  addForceAtLocalCmPosition( agx::Vec3(fx,fy,fz), agx::Vec3(px,py,pz) );
1657  }
1658 
1660  {
1661  addTorque( agx::Vec3(tx,ty,tz) );
1662  }
1663 
1665  {
1666  addLocalTorque( agx::Vec3(tx, ty, tz) );
1667  }
1668 
1670  {
1671  setForce( agx::Vec3(fx,fy,fz) );
1672  }
1673 
1675  {
1676  setTorque( agx::Vec3(tx,ty,tz) );
1677  }
1678 
1679  inline bool RigidBody::isPowerlineBody() const
1680  {
1681  return m_entity.state().powerline();
1682  }
1683 
1684  inline void RigidBody::setIsPowerlineBody(bool isHydraulicBody)
1685  {
1686  m_entity.state().setPowerline(isHydraulicBody);
1687  }
1688 
1689 } // namespace agx
1690 
1691 #ifdef _MSC_VER
1692 # pragma warning(pop)
1693 #endif
1694 
1695 #endif
agx::RigidBody::AutoSleepProperties & getAutoSleepProperties()
Definition: RigidBody.h:1575
void getRotate(T &angle, T &x, T &y, T &z) const
Get the angle and vector components represented by the quaternion.
bool getHandleAsParticle() const
Definition: RigidBody.h:1520
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
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::UInt32 getId() const
Internal method.
Definition: RigidBody.h:1435
agx::Referenced * getCustomData() const
Definition: RigidBody.h:1604
void setIsPowerlineBody(bool isHydraulicBody)
Internal method.
Definition: RigidBody.h:1684
agx::Vector< agx::ref_ptr< Geometry > > GeometryRefVector
agx::Frame * getFrame()
Returns the model frame containing model the transformation and utilities to manipulate position...
Definition: RigidBody.h:1460
agx::SetVector< ref_ptr< RigidBody > > RigidBodyRefSetVector
Definition: RigidBody.h:49
agx::Quat getCmRotation() const
Definition: RigidBody.h:1505
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Data holder for merge-split properties.
Definition: RigidBody.h:1139
agx::Physics::RigidBodyPtr getEntity() const
Internal method.
Definition: RigidBody.h:1430
bool hasConstraints() const
Definition: RigidBody.h:1594
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::RigidBody::MotionControl getMotionControl() const
Definition: RigidBody.h:1413
agx::RigidBody::MergeSplitProperties & getMergeSplitProperties()
Definition: RigidBody.h:1540
uint8_t UInt8
Definition: Integer.h:38
const agx::AffineMatrix4x4 & getCmTransform() const
Convenience methods for center of mass frame.
Definition: RigidBody.h:1480
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 ...
Definition: RigidBody.h:1664
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agx::Vec3 getVelocity() const
Velocity of center of mass frame origin, in world coordinate frame.
Definition: RigidBody.h:1485
Representation of a name string.
Definition: Name.h:32
#define AGX_FORCE_INLINE
Definition: Object.h:59
agx::Quat getRotation() const
Current model frame rotation, given in world coordinate frame.
Definition: RigidBody.h:1619
const agx::AffineMatrix4x4 & getTransform() const
Current model frame transform, given in world coordinate frame.
Definition: RigidBody.h:1609
bool getEnable() const
Access the state enable flag.
Definition: RigidBody.h:1403
void setForce(const agx::Vec3 &force)
Explicitly set the force, given in world coordinate frame, that will be affecting this body in the ne...
Base class providing referencing counted objects.
Definition: Referenced.h:119
agx::Vec3 getPosition() const
Current model frame position, given in world coordinate frame.
Definition: RigidBody.h:1614
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
agx::Vec3 getCmPosition() const
Definition: RigidBody.h:1500
This class provides conversion services between Euler angles in any of the 24 conventions and corresp...
Definition: EulerAngles.h:69
agx::MergeSplitThreshold * getMergeSplitThreshold()
Returns custom merge-split parameters for this rigid body.
Definition: RigidBody.h:1450
Pointer to a entity instance of type Physics.RigidBody.
Class which will go through contacting/separating bodies and determine if the bodies can be merged (g...
Definition: MergeSplit.h:37
agx::Vec3 getAngularAcceleration() const
Will always be 0 for KINEMATIC and STATIC bodies.
Definition: RigidBody.h:1589
Class that is a container of named properties.
Definition: Property.h:158
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
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...
agx::AutoSleepThreshold * getAutoSleepThreshold()
Returns custom auto-sleep parameters for this rigid body.
Definition: RigidBody.h:1440
Pointer to a entity instance of type Physics.Geometry.
#define CALLABLE_UNIT(param)
Definition: Object.h:74
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:48
Data holder for auto-sleep properties.
Definition: RigidBody.h:1205
agx::Vec3 getAngularVelocity() const
Angular velocity in world coordinate frame.
Definition: RigidBody.h:1490
void addForce(const agx::Vec3 &force)
Add the specified force, given in world coordinate frame, that will be affecting this body in the nex...
Contains classes for low level data storage for AGX.
Definition: Container.h:23
Class for rigid body inertia tensor and mass.
bool hasPropertyContainer() const
Definition: RigidBody.h:1418
bool isPowerlineBody() const
Definition: RigidBody.h:1679
agx::UInt16 getNumConstraints() const
Definition: RigidBody.h:1599
agx::Frame * getCmFrame()
Return the center of mass (CM) frame of this rigid body.
Definition: RigidBody.h:1470
agx::Vec3 getCmLocalTranslate() const
Definition: RigidBody.h:1495
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
Internal data for any object, ObjT, with methods: agx::Referenced* ObjT::getInternalData() const; voi...
Definition: InternalData.h:32
AGXPHYSICS_EXPORT void setMotionControl(agx::RigidBodyPtrVector &bodies, agx::RigidBody::MotionControl motionControl)
Utility function to set motion control for a vector of rigid bodies.
#define CALLABLE
Definition: Object.h:73
This body moves from the influence of forces.
Definition: RigidBody.h:69
Book keeping of a body which can be merged with other bodies.
The complete physical system with bodies, interactions, data layout, time stepper, and solver.
State
Specifies the state of auto sleep for this body.
Definition: RigidBody.h:1211
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...
The object defining a frame of reference and providing transformations operations.
Definition: Frame.h:67
Class that will investigate bodies to see if they are resting, that is if linear/angular velocity and...
Definition: AutoSleep.h:40
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
void setTorque(const agx::Vec3 &torque)
Explicitly set the torque, given in world coordinate frame, that will be affecting this body in the n...
bool isEnabled() const
Access the state enable flag.
Definition: RigidBody.h:1408
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
uint16_t UInt16
Definition: Integer.h:39
agx::PropertyContainer * getPropertyContainer() const
Access property container of this rigid body.
Definition: RigidBody.h:1423
agx::Vec3 getAcceleration() const
Will always be 0 for KINEMATIC and STATIC bodies.
Definition: RigidBody.h:1584
double Real
Definition: Real.h:42
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
Definition: RigidBody.h:65
Inheritance with partial specialization due to bug with ref_ptr containers.
uint32_t UInt32
Definition: Integer.h:40
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:37
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
AGXCORE_EXPORT EntityModel * getEntity(const agx::Path &path)
Get a entity with a specified path.
void setAngularVelocity(const agx::Vec3 &angularVelocity)
Set the angular velocity of the center of mass of this rigid body.
Specialized types of matrices for holding orthogonal transformation matrices.
T sign(T v)
Definition: Math.h:328
const agx::MassProperties * getMassProperties() const
Definition: RigidBody.h:1515
void setVelocity(const agx::Vec3 &velocity)
Set the linear velocity of the center of mass of this rigid body.