Reproduction Steps
hingeconstraint_bug_repro.rbxl (90.7 KB)
Performed on:
AMD Ryzen 3 3100 4-Core Processor
16 GB memory
NVIDIA GeForce GTX 1660
Create an anchored part and an unanchored part next to each other. Connect these parts with a HingeConstraint.
Set the HingeConstraint’s ActuatorType to Servo or Motor.
Set the max torque and angular responsiveness properties to values high enough to move the unanchored part, and set the AngularSpeed or AngularVelocity property to a very low value, in the repro file it is set to 1.8. This value may change depending on how big your parts are.
In the repro file, the parts are small.
Expected Behavior
Setting the hinge constraint’s TargetAngle to 180, I expect the part to continue spinning at the specified speed until it reaches it’s target angle of 180 degrees.
Actual Behavior
In the case of the provided repro file, setting the TargetAngle of the hinge constraint causes it to begin spinning, however at around 51 degrees it stops spinning for no apparent reason. After closer inspection, it appears to be caused by the shaft part falling asleep. It isn’t friction between the two parts, as the shaft part pauses when both parts have collision disabled. Setting torque to inf also does not prevent the part from stopping.
Workaround
The workaround for this is to do anything that would wake the part. This may include changing the part’s network ownership, touching the part, or changing any property of the part.
Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Sometimes
Date First Experienced: 2023-03-03 21:03:00 (-05:00)
2 Likes
Check whether the part does not have an outline on it to verify it is asleep through the Studio Settings option “Show sleeping parts” (IIRC, you can search “sleep” if it doesn’t give anything).
2 Likes
I am quite sure that the part is falling asleep. Didn’t know this was a setting though, but it does confirm what I figured was the case.
1 Like
Unfortunately the Part is falling asleep due to a limitation of our sleep system. Very small Parts with low angular velocities are prone to falling asleep when you don’t want them to. We are continuing to improve these cases and may have more to share in the future.
Other than the workaround you mentioned, you can also try bumping up a speed just a bit, or the size of the whole mechanism. In your repro file, changing AngularSpeed to 2 seemed to prevent it from sleeping, as did scaling the model up to a scale of 1.5 (you can lower the speed back to 1.7 and it stays awake at this size). Hopefully these changes are feasible for your project.
Changing properties on the constraint can also trigger wakes. If you can’t do the above, I recommend just changing the ServoMaxTorque up and down by 1 every frame. This should have less impact than the Part changes you mentioned as your workaround.
3 Likes
Another workaround I discovered is to weld a very long, massless, invisible, and CanCollide=false Part onto your slow-rotating-axle. That way, the far end of this dummy part is moving through the world at a relatively fast speed, even if the rotation is slow, and this seems to prevent entire assembly from falling asleep.
It’s essentially equivalent to your suggestion of scaling up the whole model, but without really scaling it up or otherwise impacting the mechanism.
1 Like
This issue also applies to more than the HingeConstraint object. I have a Torque object on a rotor for a turbofan, and if I set the torque to an arbitrary amount, it’ll move for a split second and then stop. Only after a certain value will it continue to spin, otherwise it only budges on property change at a time.