SliderJoint constructor

SliderJoint(
  1. JointConfig config,
  2. double lowerTranslation,
  3. double upperTranslation
)

A slider joint allows for relative translation and relative rotation between two rigid bodies along the axis.

config configuration profile of the joint

lowerTranslation the min movment the joint will slide

upperTranslation the max movment the joint will slide

Implementation

SliderJoint(JointConfig config, double lowerTranslation, double upperTranslation ):super(config){
  type = JointType.slider;
  localAxis1 = config.localAxis1.clone()..normalize();
  localAxis2 = config.localAxis2.clone()..normalize();

  translationalLimitMotor = LimitMotor(nor, true );
  translationalLimitMotor.lowerLimit = lowerTranslation;
  translationalLimitMotor.upperLimit = upperTranslation;

  arc = Matrix3.identity().setQuat( Quaternion(0,0,0,1).setFromUnitVectors( localAxis1, localAxis2 ) );

  localAngle1 = Vector3.zero()..tangent(localAxis1 )..normalize();
  localAngle2 = localAngle1.clone().applyMatrix3Transpose( arc );

  r3 = Rotational3Constraint(this,rotationalLimitMotor, LimitMotor( tan, true ), LimitMotor( bin, true ) );
  t3 = Translational3Constraint(this,translationalLimitMotor, LimitMotor( tan, true ), LimitMotor( bin, true ) );
}