40 #ifndef _physicsgeneric6dofconstraint_cpp
41 #define _physicsgeneric6dofconstraint_cpp
43 #include "Physics/generic6dofconstraint.h"
44 #include "Physics/rigidproxy.h"
46 #include "stringtool.h"
49 #include <btBulletDynamicsCommon.h>
71 Transform TransformA(VectorA, QuaternionA);
72 Transform TransformB(VectorB, QuaternionB);
148 { this->
Generic6dof->setLimit(Axis, Lower, Upper); }
264 { this->
Generic6dof->getTranslationalLimitMotor()->m_limitSoftness = Softness; }
267 {
return this->
Generic6dof->getTranslationalLimitMotor()->m_limitSoftness; }
270 { this->
Generic6dof->getTranslationalLimitMotor()->m_damping = Damping; }
273 {
return this->
Generic6dof->getTranslationalLimitMotor()->m_damping; }
276 { this->
Generic6dof->getTranslationalLimitMotor()->m_restitution = Restitution; }
279 {
return this->
Generic6dof->getTranslationalLimitMotor()->m_restitution; }
286 { this->
Generic6dof->getTranslationalLimitMotor()->m_maxMotorForce[Axis] = Force; }
292 {
return this->
Generic6dof->getTranslationalLimitMotor()->m_maxMotorForce[Axis]; }
298 { this->
Generic6dof->getTranslationalLimitMotor()->m_targetVelocity[Axis] = Velocity; }
304 {
return this->
Generic6dof->getTranslationalLimitMotor()->m_targetVelocity[Axis]; }
311 { this->
Generic6dof->getTranslationalLimitMotor()->m_enableMotor[Axis] = Enabled; }
317 {
return this->
Generic6dof->getTranslationalLimitMotor()->m_enableMotor[Axis]; }
327 if(0<=Axis && 5>=Axis)
329 Results.push_back(Con_Stop_ERP);
331 Results.push_back(Con_Stop_CFM);
339 Results.push_back(0);
340 Results.push_back(1);
341 Results.push_back(2);
348 Results.push_back(3);
349 Results.push_back(4);
350 Results.push_back(5);
359 return ( Con_Stop_ERP==Param && this->
Generic6dof->getFlags() & (BT_6DOF_FLAGS_ERP_STOP << (Axis * BT_6DOF_FLAGS_AXIS_SHIFT)) ) ||
360 ( Con_Stop_CFM==Param && this->
Generic6dof->getFlags() & (BT_6DOF_FLAGS_CFM_STOP << (Axis * BT_6DOF_FLAGS_AXIS_SHIFT)) ) ||
361 (
Con_CFM==Param && this->
Generic6dof->getFlags() & (BT_6DOF_FLAGS_CFM_NORM << (Axis * BT_6DOF_FLAGS_AXIS_SHIFT)) ) ;
368 { this->
Generic6dof->setUseFrameOffset(FrameOffset); }
403 if (!AngularLimitMaxForce)
408 if (!AngularMotorTargetVelocity)
413 if (!AngularMotorMaxForce)
418 if (!AngularMotorDamping)
423 if (!AngularMotorRestitution)
428 if (!AngularMotorEnabled)
434 if (!LinearMotorMaxForce)
439 if (!LinearMotorTargetVelocity)
444 if (!LinearMotorEnabled)
454 if (!LinearLimitSoftness)
459 if (!LinearLimitDamping)
464 if (!LinearLimitRestitution)
513 if(!AngularLimitMaxForce || !AngularLimitMaxForce.
GetFirstChild())
518 XML::Node AngularMotorTargetVelocity = OneNode.
GetChild(
"AngularMotorTargetVelocity");
519 if(!AngularMotorTargetVelocity || !AngularMotorTargetVelocity.
GetFirstChild())
521 vec.ProtoDeSerialize(AngularMotorTargetVelocity.
GetFirstChild());
525 if(!AngularMotorMaxForce || !AngularMotorMaxForce.
GetFirstChild())
531 if(!AngularMotorDamping || !AngularMotorDamping.
GetFirstChild())
537 if(!AngularMotorRestitution || !AngularMotorRestitution.
GetFirstChild())
539 vec.ProtoDeSerialize(AngularMotorRestitution.
GetFirstChild());
543 if(!AngularMotorEnabled || !AngularMotorEnabled.
GetFirstChild())
549 if(!LinearMotorMaxForce || !LinearMotorMaxForce.
GetFirstChild())
554 XML::Node LinearMotorTargetVelocity = OneNode.
GetChild(
"LinearMotorTargetVelocity");
555 if(!LinearMotorTargetVelocity || !LinearMotorTargetVelocity.
GetFirstChild())
557 vec.ProtoDeSerialize(LinearMotorTargetVelocity.
GetFirstChild());
561 if(!LinearMotorEnabled || !LinearMotorEnabled.
GetFirstChild())
574 {
return String(
"Generic6DofConstraint"); }