AnimatLab  2
Test
BulletAnimatSim::Environment::BlRigidBody Class Reference

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

#include <BlRigidBody.h>

+ Inheritance diagram for BulletAnimatSim::Environment::BlRigidBody:
+ Collaboration diagram for BulletAnimatSim::Environment::BlRigidBody:

Public Member Functions

btCollisionShape * CollisionShape ()
 
btCompoundShape * CompoundShape ()
 
virtual BlSimulatorGetBlSimulator ()
 
virtual osg::Matrix GetPhysicsWorldMatrix ()
 
BlMaterialTypeMaterial ()
 
virtual void MaterialTypeModified ()
 
osgbDynamics::MotionState * MotionState ()
 
virtual bool NeedCollision (BlRigidBody *lpTest)
 
btRigidBody * 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_ChildBodyAdded (RigidBody *lpChild)
 
virtual void Physics_ChildBodyRemoved (bool bHasStaticJoint)
 
virtual void Physics_CollectData ()
 
virtual void Physics_CollectExtraData ()
 
virtual void Physics_ContactSensorAdded (ContactSensor *lpSensor)
 
virtual void Physics_ContactSensorRemoved ()
 
virtual void Physics_DeleteStickyLock ()
 
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_SetCenterOfMass (float fltTx, float fltTy, float fltTz)
 
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_StepHydrodynamicSimulation ()
 
virtual void Physics_UpdateNode ()
 
virtual void Physics_WakeDynamics ()
 
virtual void SetSurfaceContactCount ()
 

Public Attributes

CStdPtrArray< BlContactPointm_aryContactPoints
 

Protected Member Functions

virtual btAnimatGeneric6DofConstraintAddDynamicJoint (BlRigidBody *lpParent, BlRigidBody *lpChild)
 
virtual void AddStaticGeometry (BlRigidBody *lpChild, btCompoundShape *btCompound, const CStdFPoint &vCom)
 
virtual void CalculateRotatedAreas ()
 Rotates the axis area values by the amount that this part is rotated by. This is used by the hydrodynamics to calculate the drag. To do that we need to know what the surface area is in the direction of movement. We calculate the area for each axis in world coordinates, but the part can be rotated at will, so we need to do the same rotation to find the actual area in world axis coordinates to use. More...
 
virtual void CalculateVolumeAndAreas ()
 
virtual void CreateDynamicPart ()
 
virtual void CreateSensorPart ()
 
virtual void CreateStaticChildren (const CStdFPoint &vCom)
 
virtual void CreateStickyLock ()
 
virtual void DeleteAttachedJointPhysics ()
 
virtual void DeleteChildPhysics ()
 
virtual void DeleteCollisionGeometry ()
 
virtual void DeleteDynamicPart ()
 
virtual void DeletePhysics (bool bIncludeChildren)
 
virtual void DeleteSensorPart ()
 
virtual void GetBaseValues ()
 
CStdFPoint Physics_GetCurrentPosition ()
 
virtual void ProcessContacts ()
 
virtual void RecreateAttachedJointPhysics ()
 
virtual void RemoveStaticGeometry (BlRigidBody *lpChild, btCompoundShape *btCompound)
 
virtual void ResetDynamicCollisionGeom ()
 
virtual void ResetSensorCollisionGeom ()
 
virtual void ResetStaticCollisionGeom ()
 
virtual void ResizePhysicsGeometry ()
 
virtual void SetupOffsetCOM (const CStdFPoint &vCom)
 Changes this body to use a btCompoundShape and adds the btCollision shape offset from -COM. More...
 

Protected Attributes

CStdPtrArray< btCollisionShape > m_aryCompoundChildShapes
 
btCollisionObject * m_btCollisionObject
 
btCollisionShape * m_btCollisionShape
 
btCompoundShape * m_btCompoundShape
 
btRigidBody * m_btPart
 
btAnimatGeneric6DofConstraint * m_btStickyLock
 
btAnimatGeneric6DofConstraint * m_btStickyLock2
 
BroadphaseNativeTypes m_eBodyType
 
float m_fltBuoyancy
 The buoyancy force applied to this part.
 
float m_fltReportBuoyancy
 The buoyancy force reported to the GUI.
 
float m_fltStaticMasses
 
BlBulletDatam_lpBulletData
 
BlMaterialTypem_lpMaterial
 The pointer to the material for this body.
 
BlSimulatorm_lpVsSim
 
osgbDynamics::MotionState * m_osgbMotion
 
float m_vAngularDragTorque [3]
 This is the drag forces applied to this body.
 
CStdFPoint m_vArea
 
float m_vLinearDragForce [3]
 This is the drag forces applied to this body.
 
CStdFPoint m_vRotatedArea
 

Friends

class BlJoint
 

Detailed Description

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

Remarks
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 BlRigidBody 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 BlBox, BlCylinder, 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 BlBox type of object. And then we would have to dynamic cast it to BlBox. 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 BlRigidBody to get access to the vortex specific data elements.
See also
RigidBody, BlBox, BlPlane, BlCylinder

Definition at line 87 of file BlRigidBody.h.

Member Function Documentation

void BulletAnimatSim::Environment::BlRigidBody::CalculateRotatedAreas ( )
protectedvirtual

Rotates the axis area values by the amount that this part is rotated by. This is used by the hydrodynamics to calculate the drag. To do that we need to know what the surface area is in the direction of movement. We calculate the area for each axis in world coordinates, but the part can be rotated at will, so we need to do the same rotation to find the actual area in world axis coordinates to use.

Author
David Cofer
Date
10/20/2013

Definition at line 630 of file BlRigidBody.cpp.

References m_vArea, and m_vRotatedArea.

void BulletAnimatSim::Environment::BlRigidBody::SetupOffsetCOM ( const CStdFPoint &  vCom)
protectedvirtual

Changes this body to use a btCompoundShape and adds the btCollision shape offset from -COM.

The reason it does this is because by default bullet always has the center of mass at the center of the object. However, if the user has specified a different COM then we need to move it away from that. The way to do ths is create a new compound shape and add our actual collision shape offset in the negative com direction. Then the motion state will match up this new collision part with the graphics correctly.

Author
David Cofer
Date
11/17/2013
Parameters
vComThe com vector that will be used for the offset. Do not add a negative to it. This will be done in the method.

Definition at line 359 of file BlRigidBody.cpp.

Member Data Documentation

CStdFPoint BulletAnimatSim::Environment::BlRigidBody::m_vArea
protected

The area of this rigid body in the each axis direction. This is used to calculate the drag force in this direction.

Definition at line 106 of file BlRigidBody.h.

Referenced by CalculateRotatedAreas().

CStdFPoint BulletAnimatSim::Environment::BlRigidBody::m_vRotatedArea
protected

The area for this part after being rotated like the part is. This basically tells the area that is in the direction that the part is moving.

Definition at line 110 of file BlRigidBody.h.

Referenced by CalculateRotatedAreas().


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