6 #include "VsMovableItem.h"
9 #include "VsRigidBody.h"
12 #include "VsSimulator.h"
13 #include "VsOsgUserData.h"
14 #include "VsOsgUserDataVisitor.h"
15 #include "VsDragger.h"
41 {
Std_TraceMsg(0,
"Caught Error in desctructor of VsCone\r\n",
"", -1,
false,
true);}
44 void VsCone::CalculateEstimatedMassAndVolume()
51 void VsCone::CreateGraphicsGeometry()
56 void VsCone::CreatePhysicsGeometry()
62 osg::ref_ptr<osg::Geode> osgNode =
new osg::Geode;
63 osgNode->addDrawable(m_osgGeometry.get());
65 m_vxGeometry = VxConvexMesh::createFromNode(osgNode.get());
68 CalculateEstimatedMassAndVolume();
75 VsRigidBody::CreateItem();
77 VsRigidBody::SetBody();
86 VsRigidBody::Initialize();
89 void VsCone::ResizePhysicsGeometry()
91 if(m_vxGeometry && m_vxCollisionGeometry && m_vxSensor)
93 if(!m_vxSensor->removeCollisionGeometry(m_vxCollisionGeometry))
94 THROW_PARAM_ERROR(Vs_Err_lRemovingCollisionGeometry, Vs_Err_strRemovingCollisionGeometry,
"ID: ",
m_strID);
96 delete m_vxCollisionGeometry;
97 m_vxCollisionGeometry = NULL;
99 CreatePhysicsGeometry();
101 CollisionGeometry(m_vxSensor->addGeometry(m_vxGeometry, iMaterialID, 0, m_lpThisRB->Density()));
103 CalculateEstimatedMassAndVolume();
virtual bool IsCollisionObject()
Query if this object is collision object.
float m_fltLowerRadius
The lower radius of the cone.
int m_iSides
The number of sides used to draw the cone.
float m_fltEstimatedVolume
The estimated volume. See m_fltEstimatedMass desciption.
Simulator * m_lpSim
The pointer to a Simulation.
virtual void DistanceUnits(std::string strUnits)
Sets the distance units.
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
osg::Geometry * CreateConeGeometry(float height, float topradius, float botradius, int sides, bool doSide, bool doTop, bool doBottom)
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.
virtual float DisplayMassUnits()
Gets the density mass units.
float m_fltDensity
Uniform density for the rigid body.
float m_fltHeight
The height of the cone.
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.
virtual void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
Joint * m_lpJointToParent
virtual std::string MaterialID()
Gets the material ID for this part.
float m_fltUpperRadius
The upper radius of the cone.
Declares the vortex structure class.