HingeJoint constructor

HingeJoint(
  1. JointConfig config, [
  2. double lowerAngleLimit = 0,
  3. double upperAngleLimit = 0
])

A hinge joint allows only for relative rotation of rigid bodies along the axis.

config configuration profile of the joint

lowerAngleLimit the min angle the motor will travel

upperAngleLimit the max angle the motor will travel

Implementation

HingeJoint(JointConfig config,[double lowerAngleLimit = 0,double upperAngleLimit = 0 ]):super(config){
  type = JointType.hinge;
  limitMotor = LimitMotor(nor, false );
  limitMotor.lowerLimit = lowerAngleLimit;
  limitMotor.upperLimit = upperAngleLimit;
  lc = LinearConstraint(this);

  // The axis in the first body's coordinate system.
  localAxis1 = config.localAxis1.clone()..normalize();
  // The axis in the second body's coordinate system.
  localAxis2 = config.localAxis2.clone()..normalize();

  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, limitMotor, LimitMotor(tan, true), LimitMotor(bin, true));
}