Breaking interaction between motorized HingeConstraint and PrismaticConstraint

Describe the bug. Describe what is happening when the bug occurs. Describe what you would normally expect to occur.

HingeConstraint with ActuatorType set to Motor will spin in random and erratic motions when connected to a PrismaticConstraint in a simple configuration. I would expect the HingeConstraint to apply a consistent rotational velocity to the free part that it is attached to.

How often does the bug happen (Everytime/sometimes/rarely)? What are the steps that reproduce the bug? Please list them in very high detail. Provide simple example places that exhibit the bug and provide description of what you believe should be the behavior.

Frequency: Everytime

Steps to reproduce (starting from Studio):

  1. Create three parts that will be referred to as “A”, “B”, and “C”. Set all parts to CanCollide false. EDIT: Set part B size to [2,0.5,0.5] and part C size to [1,10,10].
  2. Anchor part A and add an attachment whose Orientation is set to [0, 0, 90]
  3. Position part B 5 studs below part A and add an attachment whose Orientation is set to [0,0, 90]
  4. Add a PrismaticConstraint with LimitsEnabled=true, LowerLimit=-5, UpperLimit=0. Set Attachment0 to the attachment created in step 2 and Attachment1 to the attachment created in step 3.
  5. Add a second attachment to part B with default properties.
  6. Position part C in the same location as part B and add an attachment with default properties.
  7. Add a HingeConstraint with AngularVelocity=0.5, MotorMaxTorque=1e5. Set Attachment0 to the attachment created in step 5 and Attachment1 to the attachment created in step 6.
  8. Press play

Actual Behaviour: Part C bobbles back and forth randomly. GIF below.

Expected Behaviour: Part C rotates at a constant speed.

Where does the bug happen (www, gametest, etc) Is it level-specific? Is it game specific? Please post a link to the place that exhibits the issue.

Not specific to any level/game. Happens on www.roblox.com.

Link to place that exhibits the issue: https://www.roblox.com/games/4538462277/Hinge-and-Prismatic-Bad-Interaction

Would a screenshot or video help describe it to someone? If so, post one.

HingeOnPrimsaticBug

Anything else that you would want to know about the bug if it were your job to find and fix it.

  • Part B does not rotate while part C rotates, therefore PrismaticConstraint is applying itself correctly
  • Anchoring part B in the steps to reproduce will cause the HingeConstraint to rotate part C correctly.
1 Like

Could you please un-copylock the place with the repro?

I could not follow your steps properly, as it ends up in the PrismaticConstraint giving me a warning as attachments are not within limits. With all the orientations as you instructed, and Part B being 5 studs below, the length between the attachments is -5 instead of 5 (and Parts’ orientations being 0,0,0).

I have un-copylocked the place!

I have since determined that this bug occurs only when the center hinge in the model is small enough. It appears that this issue is only related to the HingeConstraint, and not its interaction with other constraints.

Observe:

I also noticed that Positions and Orientations on the parts & attachments are a bit wonky, and not really aligned with the rest of the stuff, so I fixed that, but it didn’t solve the issue.

However, you really shouldn’t be using this kind of setup anyways.
You can easily recreate it just by using one CyllindricalConstraint and two parts, instead of trying to use both Prismatic and Hinge Constraints with three parts.

Here’s the place file: wheel.rbxl (22.5 KB)

1 Like

Aha, I completely forgot that CylindricalConstraint and be used to solve this problem with less parts and overall less objects.

This is an issue with high mass ratios. When you have a part between two constraints that has a much higher or lower mass than the parts it’s connected to, you can run into stability issues. This is why you noticed an improvement when you made Part B larger. But alternatively you could increase its density to make the mass closer to the spinning wheel’s mass. Or, like you also mentioned, you could use a Cylindrical Constraint for your case instead so you don’t need the intermediate part.

4 Likes