6 #include "BlOsgGeometry.h"
8 #include "BlMotorizedJoint.h"
9 #include "BlRigidBody.h"
10 #include "BlMeshBase.h"
12 #include "BlSimulator.h"
38 {
Std_TraceMsg(0,
"Caught Error in desctructor of BlMesh/\r\n",
"", -1,
false,
true);}
55 return Mesh::Freeze();
60 BoundingBox BlMesh::Physics_GetBoundingBox()
66 OsgCalculateBoundingBox bbox ;
67 m_osgNode->accept( bbox );
68 osg::BoundingBox bb = bbox.getBoundBox();
69 abb.Set(bb.xMin(), bb.yMin(), bb.zMin(), bb.xMax(), bb.yMax(), bb.zMax());
73 abb.Set(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
83 CalculateVolumeAndAreas();
85 BlMeshBase::CreateItem();
90 void BlMesh::CalculateVolumeAndAreas()
93 if(m_lpThisRB->IsCollisionObject())
95 m_fltVolume = OsgConvexHullVolume(m_osgMeshNode.get());
99 BoundingBox box = Physics_GetBoundingBox();
100 m_vArea.x = box.Height() * box.Width();
101 m_vArea.y = box.Length() * box.Width();
102 m_vArea.z = box.Length() * box.Height();
113 Mass(fltMass,
false,
false);
122 Mesh::CreateJoints();
123 BlMeshBase::Initialize();
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
std::string m_strCollisionMeshType
Type of the collision mesh. Can be Convex or Triangular.
float m_fltMass
The mass of the object.
float m_fltVolume
The volume for the rigid body.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
virtual void CreateJoint()
Creates the joint.
float m_fltDensity
Uniform density for the rigid body.
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
virtual void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
Joint * m_lpJointToParent
virtual bool Freeze()
Freezes this object. In Bullet triangular meshes are not allowed to be dynamic, so I am overriding th...