8 #include "VsMovableItem.h"
11 #include "VsMotorizedJoint.h"
12 #include "VsRigidBody.h"
15 #include "VsSimulator.h"
16 #include "VsOsgUserData.h"
17 #include "VsOsgUserDataVisitor.h"
18 #include "VsDragger.h"
55 {
Std_TraceMsg(0,
"Caught Error in desctructor of VsUniversal/\r\n",
"", -1,
false,
true);}
58 void VsUniversal::DeletePhysics()
63 if(GetVsSimulator() && GetVsSimulator()->Universe())
65 GetVsSimulator()->Universe()->removeConstraint(
m_vxSocket);
76 void VsUniversal::SetupPhysics()
82 THROW_ERROR(Al_Err_lParentNotDefined, Al_Err_strParentNotDefined);
85 THROW_ERROR(Al_Err_lChildNotDefined, Al_Err_strChildNotDefined);
89 THROW_ERROR(Vs_Err_lUnableToConvertToVsRigidBody, Vs_Err_strUnableToConvertToVsRigidBody);
93 THROW_ERROR(Vs_Err_lUnableToConvertToVsRigidBody, Vs_Err_strUnableToConvertToVsRigidBody);
95 CStdFPoint vGlobal = this->GetOSGWorldCoords();
98 VxOSG::copyOsgMatrix_to_VxReal44(this->GetOSGWorldMatrix(
true), vMT);
99 Vx::VxTransform vTrans(vMT);
101 vTrans.getRotationEulerAngles(vxRot);
103 CStdFPoint vLocalRot(vxRot[0], vxRot[1], vxRot[2]);
105 VxVector3 pos((
double) vGlobal.x, (
double) vGlobal.y, (
double) vGlobal.z);
106 VxVector3 axis = NormalizeAxis(vLocalRot);
109 m_vxSocket =
new VxHomokinetic(lpVsParent->Part(), lpVsChild->Part(), pos.v, axis.v);
112 GetVsSimulator()->Universe()->addConstraint(
m_vxSocket);
127 #pragma region DataAccesMethods
130 bool VsUniversal::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
132 if(VsJoint::Physics_SetData(strDataType, strValue))
135 if(BallSocket::SetData(strDataType, strValue,
false))
140 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
145 void VsUniversal::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
147 VsJoint::Physics_QueryProperties(aryProperties);
148 BallSocket::QueryProperties(aryProperties);
virtual void DisableCollision(RigidBody *lpBody)
Disables collision between the past-in object and this object.
virtual void EnableCollision(RigidBody *lpBody)
Enables collision between the past-in object and this object.
A common class for all rigid body data specific to vortex.
std::string m_strID
The unique Id for this object.
VsUniversal()
Default constructor.
Declares the vs universal class.
virtual ~VsUniversal()
Destructor.
RigidBody * m_lpChild
The child rigid body for this joint.
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.
Vx::VxHomokinetic * m_vxSocket
The vortex socket class.
virtual void SetupGraphics()
Sets up the graphics for the joint.
virtual void CreateJoint()
Creates the joint.
Declares the vortex structure class.