8 #include "VsMovableItem.h"
11 #include "VsMotorizedJoint.h"
12 #include "VsRigidBody.h"
14 #include "VsSimulator.h"
15 #include "VsDragger.h"
51 {
Std_TraceMsg(0,
"Caught Error in desctructor of VsBallSocket\r\n",
"", -1,
false,
true);}
54 void VsBallSocket::DeletePhysics()
59 if(GetVsSimulator() && GetVsSimulator()->Universe())
61 GetVsSimulator()->Universe()->removeConstraint(
m_vxSocket);
72 void VsBallSocket::SetupPhysics()
78 THROW_ERROR(Al_Err_lParentNotDefined, Al_Err_strParentNotDefined);
81 THROW_ERROR(Al_Err_lChildNotDefined, Al_Err_strChildNotDefined);
85 THROW_ERROR(Vs_Err_lUnableToConvertToVsRigidBody, Vs_Err_strUnableToConvertToVsRigidBody);
89 THROW_ERROR(Vs_Err_lUnableToConvertToVsRigidBody, Vs_Err_strUnableToConvertToVsRigidBody);
91 CStdFPoint vGlobal = this->GetOSGWorldCoords();
94 VxOSG::copyOsgMatrix_to_VxReal44(this->GetOSGWorldMatrix(), vMT);
95 Vx::VxTransform vTrans(vMT);
97 vTrans.getRotationEulerAngles(vxRot);
99 CStdFPoint vLocalRot(vxRot[0], vxRot[1], vxRot[2]);
101 VxVector3 pos((
double) vGlobal.x, (
double) vGlobal.y, (
double) vGlobal.z);
102 VxVector3 axis = NormalizeAxis(vLocalRot);
104 m_vxSocket =
new VxBallAndSocket(lpVsParent->Part(), lpVsChild->Part(), pos.v, axis.v);
107 GetVsSimulator()->Universe()->addConstraint(
m_vxSocket);
122 #pragma region DataAccesMethods
124 bool VsBallSocket::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
126 if(VsJoint::Physics_SetData(strDataType, strValue))
129 if(BallSocket::SetData(strDataType, strValue,
false))
134 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
139 void VsBallSocket::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
141 VsJoint::Physics_QueryProperties(aryProperties);
142 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.
virtual void CreateJoint()
Creates the joint.
std::string m_strID
The unique Id for this object.
virtual ~VsBallSocket()
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.
virtual void SetupGraphics()
Sets up the graphics for the joint.
Vx::VxBallAndSocket * m_vxSocket
The vortex socket class.
VsBallSocket()
Default constructor.
Declares the vortex ball socket class.