Return the force (in Newtons) on body 2 required to satisfy the joint constraint in world-space * @return The current force (in Newtons) applied on body 2 */
| 299 | * @return The current force (in Newtons) applied on body 2 |
| 300 | */ |
| 301 | Vector3 SliderJoint::getReactionForce(decimal timeStep) const { |
| 302 | assert(timeStep > MACHINE_EPSILON); |
| 303 | |
| 304 | const uint32 jointIndex = mWorld.mSliderJointsComponents.getEntityIndex(mEntity); |
| 305 | |
| 306 | const Vector2 translationImpulse = mWorld.mSliderJointsComponents.mImpulseTranslation[jointIndex]; |
| 307 | const Vector3& n1 = mWorld.mSliderJointsComponents.mN1[jointIndex]; |
| 308 | const Vector3& n2 = mWorld.mSliderJointsComponents.mN2[jointIndex]; |
| 309 | const Vector3 impulseJoint = n1 * translationImpulse.x + n2 * translationImpulse.y; |
| 310 | |
| 311 | const Vector3& sliderAxisWorld = mWorld.mSliderJointsComponents.mSliderAxisWorld[jointIndex]; |
| 312 | const Vector3 impulseLowerLimit = mWorld.mSliderJointsComponents.mImpulseLowerLimit[jointIndex] * sliderAxisWorld; |
| 313 | const Vector3 impulseUpperLimit = -mWorld.mSliderJointsComponents.mImpulseUpperLimit[jointIndex] * sliderAxisWorld; |
| 314 | Vector3 impulseMotor = -mWorld.mSliderJointsComponents.mImpulseMotor[jointIndex] * sliderAxisWorld; |
| 315 | |
| 316 | return (impulseJoint + impulseLowerLimit + impulseUpperLimit + impulseMotor) / timeStep; |
| 317 | } |
| 318 | |
| 319 | // Return the torque (in Newtons * meters) on body 2 required to satisfy the joint constraint in world-space |
| 320 | /** |
nothing calls this directly
no test coverage detected