AnimatLab  2
VortexAnimatSim::Environment::VsRigidBody Class Reference

A common class for all rigid body data specific to vortex. More...

#include <VsRigidBody.h>

+ Inheritance diagram for VortexAnimatSim::Environment::VsRigidBody:
+ Collaboration diagram for VortexAnimatSim::Environment::VsRigidBody:

Public Member Functions

virtual void BuildLocalMatrix ()
 Builds the local matrix. More...
Vx::VxCollisionGeometry * CollisionGeometry ()
virtual void CollisionGeometry (Vx::VxCollisionGeometry *vxGeometry)
virtual int GetPartIndex (VxPart *vxP0, VxPart *vxP1)
Vx::VxNode GraphicsNode ()
virtual void Initialize ()
virtual osg::Group * ParentOSG ()
 Gets the parent osg node. More...
Vx::VxPart * Part ()
virtual void Physics_AddBodyForceAtLocalPos (float fltPx, float fltPy, float fltPz, float fltFx, float fltFy, float fltFz, bool bScaleUnits)
virtual void Physics_AddBodyForceAtWorldPos (float fltPx, float fltPy, float fltPz, float fltFx, float fltFy, float fltFz, bool bScaleUnits)
virtual void Physics_AddBodyTorque (float fltTx, float fltTy, float fltTz, bool bScaleUnits)
virtual void Physics_CollectData ()
virtual void Physics_CollectExtraData ()
virtual void Physics_DisableCollision (RigidBody *lpBody)
virtual void Physics_EnableCollision (RigidBody *lpBody)
virtual void Physics_FluidDataChanged ()
virtual float * Physics_GetDataPointer (const std::string &strDataType)
virtual float Physics_GetDensity ()
virtual float Physics_GetMass ()
virtual CStdFPoint Physics_GetVelocityAtPoint (float x, float y, float z)
virtual bool Physics_HasCollisionGeometry ()
virtual bool Physics_IsDefined ()
virtual bool Physics_IsGeometryDefined ()
virtual void Physics_ResetSimulation ()
virtual void Physics_Resize ()
virtual void Physics_ResizeSelectedReceptiveFieldVertex ()
virtual void Physics_SelectedVertex (float fltXPos, float fltYPos, float fltZPos)
virtual void Physics_SetCenterOfMass (float fltTx, float fltTy, float fltTz)
virtual void Physics_SetColor ()
virtual void Physics_SetDensity (float fltVal)
virtual void Physics_SetFreeze (bool bVal)
virtual void Physics_SetMass (float fltVal)
virtual void Physics_SetMaterialID (std::string strID)
virtual void Physics_SetVelocityDamping (float fltLinear, float fltAngular)
virtual void Physics_TextureChanged ()
virtual void Physics_UpdateMatrix ()
virtual void Physics_UpdateNode ()
virtual void Physics_WakeDynamics ()
Vx::VxCollisionSensor * Sensor ()
virtual void SetBody ()
virtual void SetupPhysics ()
- Public Member Functions inherited from VortexAnimatSim::Environment::VsBody
 VsBody ()
 Default constructor. More...
virtual ~VsBody ()
 Destructor. More...
virtual void Physics_ChildBodyAdded (RigidBody *lpChild)
virtual void Physics_ChildBodyRemoved (bool bHasStaticJoint)
virtual void Physics_ContactSensorAdded (ContactSensor *lpSensor)
virtual void Physics_ContactSensorRemoved ()
virtual void Physics_DeleteStickyLock ()
virtual void Physics_StepHydrodynamicSimulation ()
- Public Member Functions inherited from VortexAnimatSim::Environment::VsMovableItem
virtual void BuildLocalMatrix (CStdFPoint localPos, CStdFPoint localRot, std::string strName)
virtual void CreateItem ()
virtual void EndGripDrag ()
virtual osg::Matrix FinalMatrix ()
virtual osg::MatrixTransform * GetCameraMatrixTransform ()
 Gets the matrix transform used by the camera for the mouse spring. More...
virtual osg::MatrixTransform * GetMatrixTransform ()
virtual CStdFPoint GetOSGWorldCoords ()
virtual osg::Matrix GetOSGWorldMatrix (bool bUpdate=false)
virtual osg::Matrix GetParentWorldMatrix ()
virtual VsSimulatorGetVsSimulator ()
virtual osg::Matrix GetWorldMatrix ()
virtual osg::Matrix LocalMatrix ()
virtual osg::Group * NodeGroup ()
virtual void Physics_AfterResetSimulation ()
virtual bool Physics_CalculateLocalPosForWorldPos (float fltWorldX, float fltWorldY, float fltWorldZ, CStdFPoint &vLocalPos)
virtual BoundingBox Physics_GetBoundingBox ()
virtual float Physics_GetBoundingRadius ()
virtual std::string Physics_GetLocalTransformMatrixString ()
virtual std::string Physics_ID ()
virtual void Physics_LoadLocalTransformMatrix (CStdXml &oXml)
virtual void Physics_OrientNewPart (float fltXPos, float fltYPos, float fltZPos, float fltXNorm, float fltYNorm, float fltZNorm)
virtual void Physics_PositionChanged ()
virtual void Physics_ResetGraphicsAndPhysics ()
virtual void Physics_ResizeDragHandler (float fltRadius)
virtual void Physics_RotationChanged ()
virtual void Physics_SaveLocalTransformMatrix (CStdXml &oXml)
virtual void Physics_Selected (bool bValue, bool bSelectMultiple)
virtual void Physics_SetChild (MovableItem *lpParent)
virtual void Physics_SetParent (MovableItem *lpParent)
virtual void Physics_UpdateAbsolutePosition ()
virtual osg::Group * RootGroup ()
virtual void SetAlpha ()
virtual void SetColor (CStdColor &vAmbient, CStdColor &vDiffuse, CStdColor &vSpecular, float fltShininess)
virtual void SetCulling ()
virtual void SetMaterialAlpha (osg::Material *osgMat, osg::StateSet *ss, float fltAlpha)
virtual void SetTexture (std::string strTexture)
virtual void SetVisible (bool bVisible)
virtual void SetVisible (osg::Node *osgNode, bool bVisible)
virtual VsMovableItemVsParent ()
virtual void WorldToBodyCoords (VxReal3 vWorldPos, StdVector3 &vLocalPos)
- Public Member Functions inherited from AnimatSim::Environment::IPhysicsMovableItem
virtual void Physics_SetChild (MovableItem *lpChild)=0
virtual void Physics_SetParent (MovableItem *lpParent)=0
- Public Member Functions inherited from AnimatSim::Environment::IPhysicsBody
virtual void Physics_ChildBodyAdded (RigidBody *lpChild)=0
virtual void Physics_ContactSensorAdded (ContactSensor *lpSensor)=0
virtual void Physics_DisableCollision (RigidBody *lpBody)=0
virtual void Physics_EnableCollision (RigidBody *lpBody)=0

Protected Member Functions

virtual void CalculateEstimatedMassAndVolume ()
virtual void CreateDynamicPart ()
virtual void CreateSensorPart ()
virtual void CreateStaticPart ()
virtual void DeletePhysics ()
virtual void GetBaseValues ()
virtual void HideSelectedVertex ()
CStdFPoint Physics_GetCurrentPosition ()
virtual void ProcessContacts ()
virtual void RemoveStaticPart ()
virtual void ResetSensorCollisionGeom ()
virtual void ResetStaticCollisionGeom ()
virtual void SetFollowEntity (VsRigidBody *lpEntity)
virtual void SetThisPointers ()
virtual void ShowSelectedVertex ()
virtual void UpdatePositionAndRotationFromMatrix ()
- Protected Member Functions inherited from VortexAnimatSim::Environment::VsMovableItem
virtual void AttachedPartMovedOrRotated (std::string strID)
virtual void CreateDragger (std::string strName)
virtual void CreateGeometry ()
virtual void CreateGraphicsGeometry ()
virtual void CreatePhysicsGeometry ()
virtual void CreateSelectedGraphics (std::string strName)
virtual void CreateSelectedVertex (std::string strName)
virtual void DeleteGraphics ()
virtual void DeleteSelectedVertex ()
virtual void GeometryRotationMatrix (osg::Matrix osgGeometryMT)
virtual void LocalMatrix (osg::Matrix osgLocalMT)
virtual void ResizePhysicsGeometry ()
virtual void SetupGraphics ()
virtual void UpdatePositionAndRotationFromMatrix (osg::Matrix osgMT)
virtual void UpdateWorldMatrix ()

Protected Attributes

float m_fltBlank
float m_fltEstimatedMass
float m_fltEstimatedVolume
 The estimated volume. See m_fltEstimatedMass desciption.
RigidBody * m_lpThisRB
float m_vAngularAcceleration [3]
float m_vAngularVelocity [3]
float m_vForce [3]
float m_vLinearAcceleration [3]
float m_vLinearVelocity [3]
CStdFPoint m_vPos
float m_vTorque [3]
VxCollisionGeometry * m_vxCollisionGeometry
VxGeometry * m_vxGeometry
VxNode m_vxGraphicNode
VxPart * m_vxPart
VxCollisionSensor * m_vxSensor
- Protected Attributes inherited from VortexAnimatSim::Environment::VsBody
Vx::VxEntity::EntityControlTypeEnum m_eControlType
BodyPart * m_lpThisBP
- Protected Attributes inherited from VortexAnimatSim::Environment::VsMovableItem
bool m_bCullBackfaces
osg::StateAttribute::GLMode m_eTextureMode
float m_fltNullReport
 This is used to report back 0 from GetDataPointer for items that are not supported in vortex.
AnimatBase * m_lpThisAB
MovableItem * m_lpThisMI
osg::ref_ptr< osg::CullFace > m_osgCull
osg::ref_ptr< VsDragger > m_osgDragger
osg::Matrix m_osgFinalMatrix
osg::ref_ptr< osg::Geometry > m_osgGeometry
osg::ref_ptr< osg::MatrixTransform > m_osgGeometryRotationMT
osg::Matrix m_osgLocalMatrix
osg::ref_ptr< osg::Material > m_osgMaterial
osg::ref_ptr< osgManipulator::Selection > m_osgMT
osg::ref_ptr< osg::Node > m_osgNode
osg::ref_ptr< osg::Group > m_osgNodeGroup
osg::ref_ptr< osg::Group > m_osgParent
osg::ref_ptr< osg::Group > m_osgRoot
osg::ref_ptr< osg::Group > m_osgSelectedGroup
osg::ref_ptr< osg::MatrixTransform > m_osgSelVertexMT
osg::ref_ptr< osg::Geode > m_osgSelVertexNode
osg::ref_ptr< osg::StateSet > m_osgStateSet
osg::ref_ptr< osg::Texture2D > m_osgTexture
osg::Matrix m_osgWorldMatrix

Detailed Description

A common class for all rigid body data specific to vortex.

This is a common class for the rigid body objects that specifically holds vortex data and methods. I had hoped to not have this class. However, it proved necessary. The reason is that rigid bodies like the box and cylinder all had common data items asociated with them like the m_iBodyID that need to be used in various places in order to get things done. When we are in one of the overridden virtual functions we need a way to get at these data members for a rigid body. If we have this class then we can just do a dynamic cast to convert it into a VsRigidBody and access those items that way. If we do not have this common class and instead just duplicated these items in each of the different VsBox, VsCylinder, etc. classes then we have a problem. If we put virtual accessor functions for those items in the RigidBody class then that is not appropriate because the animat library is not supposed to know anything about data elements specific to vortex. What happens if you move to a different physics engine? Do you put data elements for that one in RigidBody also. Clearly that will not work as a solution. The only other way would be to try and determine the actual type of object you have and do a specific cast to that one. So if we are looking at the parent of the current rigid body and we have it as a RigidBody pointer then we would have to find some way to determine that it was say a VsBox type of object. And then we would have to dynamic cast it to VsBox. Again, this would be horribly messy with switches and other stuff. This was the cleanest solution that I could see. With this we just always cast the RigidBody to a VsRigidBody to get access to the vortex specific data elements.
See also
RigidBody, VsBox, VsPlane, VsCylinder

Definition at line 55 of file VsRigidBody.h.

Member Function Documentation

void VortexAnimatSim::Environment::VsRigidBody::BuildLocalMatrix ( )

Builds the local matrix.

If this is the root object then use the world coordinates of the structure instead of the local coordinates of the rigid body.


Reimplemented from VortexAnimatSim::Environment::VsMovableItem.

Definition at line 346 of file VsRigidBody.cpp.

osg::Group * VortexAnimatSim::Environment::VsRigidBody::ParentOSG ( )

Gets the parent osg node.

If this is the root object then attach it directly to the OSG root node because we are building its local matrix using the structures absolute position. This is so the vortex stuff works correctly, and so that you can move the structure by moving the root body.

Pointer to the OSG group node of the parent.

Implements VortexAnimatSim::Environment::VsMovableItem.

Definition at line 370 of file VsRigidBody.cpp.

Member Data Documentation

float VortexAnimatSim::Environment::VsRigidBody::m_fltBlank

Used to send back 0 for variables that are supported in other physics engines but not in this one.

Definition at line 96 of file VsRigidBody.h.

float VortexAnimatSim::Environment::VsRigidBody::m_fltEstimatedMass

Static parts do not have their mass/volume computed for them by vortex. This presents a problem when trying to convert them to another physics engine like bullet that uses mass instead. When we are saving out the mass of the part then we need to be able to get some reliable estimate of what it is if it is static. We use these estimations for that purpose.

Definition at line 89 of file VsRigidBody.h.

The documentation for this class was generated from the following files: