8 #include "VsMovableItem.h"
11 #include "VsRigidBody.h"
14 #include "VsSimulator.h"
15 #include "VsOsgUserData.h"
16 #include "VsOsgUserDataVisitor.h"
17 #include "VsDragger.h"
45 {
Std_TraceMsg(0,
"Caught Error in desctructor of VsTorus/\r\n",
"", -1,
false,
true);}
48 void VsTorus::CreateGraphicsGeometry()
53 void VsTorus::CreatePhysicsGeometry()
59 osg::ref_ptr<osg::Geode> osgNode =
new osg::Geode;
60 osgNode->addDrawable(m_osgGeometry.get());
62 m_vxGeometry = GetVsSimulator()->CreatTriangleMeshFromOsg(osgNode.get());
70 VsRigidBody::CreateItem();
72 VsRigidBody::SetBody();
80 Torus::CreateJoints();
81 VsRigidBody::Initialize();
84 void VsTorus::ResizePhysicsGeometry()
86 if(m_vxGeometry && m_vxCollisionGeometry && m_vxSensor)
88 if(!m_vxSensor->removeCollisionGeometry(m_vxCollisionGeometry))
89 THROW_PARAM_ERROR(Vs_Err_lRemovingCollisionGeometry, Vs_Err_strRemovingCollisionGeometry,
"ID: ",
m_strID);
91 delete m_vxCollisionGeometry;
92 m_vxCollisionGeometry = NULL;
94 CreatePhysicsGeometry();
96 CollisionGeometry(m_vxSensor->addGeometry(m_vxGeometry, iMaterialID, 0, m_lpThisRB->Density()));
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
virtual bool IsCollisionObject()
Query if this object is collision object.
Declares the vortex Torus class.
VsTorus()
Default constructor.
Simulator * m_lpSim
The pointer to a Simulation.
float m_fltInsideRadius
The inside radius of the torus.
int m_iRings
The number of rings used to draw the torus.
virtual void CreateJoint()
Creates the joint.
std::string m_strID
The unique Id for this object.
virtual int GetMaterialID(std::string strID)
Gets a material identifier from the physics engine for the specified unique ID.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
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.
float m_fltOutsideRadius
The outside radius of the torus.
int m_iSides
The number of sides used to draw the torus.
Joint * m_lpJointToParent
virtual void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
virtual std::string MaterialID()
Gets the material ID for this part.
Declares the vortex structure class.