An issue with HingeConstraint

As intended, HingeConstraint will try to find the lowest change of angle to get from its current angle to its desired angle. Unfortunately, this behavior is causing a fairly critical issue: It will ignore limits (And therefore just hit them) trying to get to its new angle.

To reproduce:

  • Create two parts, link the top of one to the bottom of the other with a HingeConstraint
  • Set ActuatorType to Servo
  • Set LimitsEnabled to true
  • Set LowerAngle (Limit) to -150
  • Set UpperAngle (Limit) to 45
  • Set AngularSpeed (Servo) to >0
  • Set ServoMaxTorque to 1000 (Just so that it can move)
  • Now, set TargetAngle to -150
  • Wait until it hits the target angle
  • Finally set TargetAngle to 45 - Note that it attempts to loop back around (by going to -180/180 from -150) to get to 45 in the shortest way possible, yet it can’t because of the limit in place.
1 Like