40 #ifndef _physicssliderconstraint_cpp
41 #define _physicssliderconstraint_cpp
43 #include "Physics/sliderconstraint.h"
44 #include "Physics/rigidproxy.h"
46 #include "stringtool.h"
49 #include <btBulletDynamicsCommon.h>
58 SliderConstraint::SliderConstraint(RigidProxy* ProxyA, RigidProxy* ProxyB,
const Vector3& VectorA,
const Vector3& VectorB,
const Quaternion& QuaternionA,
const Quaternion& QuaternionB,
bool UseLinearReferenceA)
62 btTransform transa(QuaternionA.GetBulletQuaternion(), VectorA.GetBulletVector3());
63 btTransform transb(QuaternionB.GetBulletQuaternion(), VectorB.GetBulletVector3());
73 SliderConstraint::SliderConstraint(
RigidProxy* ProxyB,
const Vector3& VectorB,
const Quaternion& QuaternionB,
bool UseLinearReferenceA)
96 {
return this->Slider->getFrameOffsetA(); }
99 {
return this->Slider->getFrameOffsetB(); }
109 {
return Vector3(this->Slider->getFrameOffsetA().getOrigin()); }
112 {
return Vector3(this->Slider->getFrameOffsetB().getOrigin()); }
122 {
return Quaternion(this->Slider->getFrameOffsetA().getRotation()); }
125 {
return Quaternion(this->Slider->getFrameOffsetB().getRotation()); }
127 void SliderConstraint::SetUpperLinLimit(
const Real& UpperLimit)
129 this->Slider->setUpperLinLimit(UpperLimit);
132 void SliderConstraint::SetUpperAngLimit(
const Real& UpperLimit)
134 this->Slider->setUpperAngLimit(UpperLimit);
137 void SliderConstraint::SetLowerLinLimit(
const Real& LowerLimit)
139 this->Slider->setLowerLinLimit(LowerLimit);
142 void SliderConstraint::SetLowerAngLimit(
const Real& LowerLimit)
144 this->Slider->setLowerAngLimit(LowerLimit);
147 void SliderConstraint::SetPoweredLinMotor(
bool OnOff)
149 this->Slider->setPoweredLinMotor(OnOff);
152 void SliderConstraint::SetTargetLinMotorVelocity(
const Real& TargetLinMotorVelocity)
154 this->Slider->setTargetLinMotorVelocity(TargetLinMotorVelocity);
157 void SliderConstraint::SetMaxLinMotorForce(
const Real& MaxLinMotorForce)
159 this->Slider->setMaxLinMotorForce(MaxLinMotorForce);
162 void SliderConstraint::SetPoweredAngMotor(
bool OnOff)
164 this->Slider->setPoweredAngMotor(OnOff);
167 void SliderConstraint::SetTargetAngMotorVelocity(
const Real& TargetAngMotorVelocity)
169 this->Slider->setTargetAngMotorVelocity(TargetAngMotorVelocity);
172 void SliderConstraint::SetMaxAngMotorForce(
const Real& MaxAngMotorForce)
174 this->Slider->setMaxAngMotorForce(MaxAngMotorForce);
177 void SliderConstraint::SetUseFrameOffset(
bool FrameOffset)
179 this->Slider->setUseFrameOffset(FrameOffset);
182 void SliderConstraint::SetSoftnessDirLin(
const Real& SoftnessDirLin)
184 this->Slider->setSoftnessDirLin(SoftnessDirLin);
187 void SliderConstraint::SetRestitutionDirLin(
const Real& RestitutionDirLin)
189 this->Slider->setRestitutionDirLin(RestitutionDirLin);
192 void SliderConstraint::SetDampingDirLin(
const Real& DampingDirLin)
194 this->Slider->setDampingDirLin(DampingDirLin);
197 void SliderConstraint::SetSoftnessDirAng(
const Real& SoftnessDirAng)
199 this->Slider->setSoftnessDirAng(SoftnessDirAng);
202 void SliderConstraint::SetRestitutionDirAng(
const Real& RestitutionDirAng)
204 this->Slider->setRestitutionDirAng(RestitutionDirAng);
207 void SliderConstraint::SetDampingDirAng(
const Real& DampingDirAng)
209 this->Slider->setDampingDirAng(DampingDirAng);
212 void SliderConstraint::SetSoftnessLimLin(
const Real& SoftnessLimLin)
214 this->Slider->setSoftnessLimLin(SoftnessLimLin);
217 void SliderConstraint::SetRestitutionLimLin(
const Real& RestitutionLimLin)
219 this->Slider->setRestitutionLimLin(RestitutionLimLin);
222 void SliderConstraint::SetDampingLimLin(
const Real& DampingLimLin)
224 this->Slider->setDampingLimLin(DampingLimLin);
227 void SliderConstraint::SetSoftnessLimAng(
const Real& SoftnessLimAng)
229 this->Slider->setSoftnessLimAng(SoftnessLimAng);
232 void SliderConstraint::SetRestitutionLimAng(
const Real& RestitutionLimAng)
234 this->Slider->setRestitutionLimAng(RestitutionLimAng);
237 void SliderConstraint::SetDampingLimAng(
const Real& DampingLimAng)
239 this->Slider->setDampingLimAng(DampingLimAng);
242 void SliderConstraint::SetSoftnessOrthoLin(
const Real& SoftnessOrthoLin)
244 this->Slider->setSoftnessOrthoLin(SoftnessOrthoLin);
247 void SliderConstraint::SetRestitutionOrthoLin(
const Real& RestitutionOrthoLin)
249 this->Slider->setRestitutionOrthoLin(RestitutionOrthoLin);
252 void SliderConstraint::SetDampingOrthoLin(
const Real& DampingOrthoLin)
254 this->Slider->setDampingOrthoLin(DampingOrthoLin);
257 void SliderConstraint::SetSoftnessOrthoAng(
const Real& SoftnessOrthoAng)
259 this->Slider->setSoftnessOrthoAng(SoftnessOrthoAng);
262 void SliderConstraint::SetRestitutionOrthoAng(
const Real& RestitutionOrthoAng)
264 this->Slider->setRestitutionOrthoAng(RestitutionOrthoAng);
267 void SliderConstraint::SetDampingOrthoAng(
const Real& DampingOrthoAng)
269 this->Slider->setDampingOrthoAng(DampingOrthoAng);
278 if(0<=Axis && 5>=Axis)
280 Results.push_back(Con_Stop_ERP);
282 Results.push_back(Con_Stop_CFM);
290 Results.push_back(0);
291 Results.push_back(1);
292 Results.push_back(2);
299 Results.push_back(3);
300 Results.push_back(4);
301 Results.push_back(5);
311 if( Con_Stop_ERP == Param )
313 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_ERP_LIMLIN )
return true;
314 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_ERP_ORTLIN )
return true;
315 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_ERP_LIMANG )
return true;
316 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_ERP_ORTANG )
return true;
318 else if( Con_Stop_CFM == Param )
320 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_DIRLIN )
return true;
321 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_DIRANG )
return true;
325 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_LIMLIN )
return true;
326 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_ORTLIN )
return true;
327 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_LIMANG )
return true;
328 if( this->Slider->getFlags() & BT_SLIDER_FLAGS_CFM_ORTANG )
return true;