preSolve method
Prepare for solving the constraint
Implementation
@override
void preSolve(double timeStep,double invTimeStep ) {
updateAnchorPoints();
ax1.copy(localAxis1).applyMatrix3(body1!.rotation, true);
an1.copy(localAngle1).applyMatrix3(body1!.rotation, true);
ax2.copy(localAxis2).applyMatrix3(body2!.rotation, true);
an2.copy(localAngle2).applyMatrix3(body2!.rotation, true);
r3.limitMotor1.angle = Math.dotVectors(ax1, ax2);
var limite = Math.dotVectors(an1, ax2);
if( Math.dotVectors(ax1, tmp.crossVectors(an1, ax2)) < 0){
rotationalLimitMotor1.angle = -limite;
}
else{
rotationalLimitMotor1.angle = limite;
}
limite = Math.dotVectors(an2, ax1);
if(Math.dotVectors(ax2, tmp.crossVectors(an2, ax1)) < 0 ){
rotationalLimitMotor2.angle = -limite;
}
else{
rotationalLimitMotor2.angle = limite;
}
nor.crossVectors( ax1, ax2 ).normalize();
tan.crossVectors( nor, ax2 ).normalize();
bin.crossVectors( nor, ax1 ).normalize();
r3.preSolve(timeStep,invTimeStep);
t3.preSolve(timeStep,invTimeStep);
}