CylindricalConstraints remain awake with residual energy

If you open the default racing template that was recently introduced, enter the vehicle, drive the vehicle and while driving jump out by pressing E, you get the following effect where the vehicle wants to move either slightly forward or backward

Here is a GIF showing the issue:
RobloxStudioBeta_EVjsl6ofty

It’s important to note that all the values here are properly being zeroed out, this is not an issue with the programming of the vehicle but rather a bug with the engine

Expected behavior

The constraint should come to a rest and remain at a rest

5 Likes

Hi, thanks for posting! I’ll take a look.

1 Like

Hi again!

I noticed a high mass ratio (100:1) between the knuckle and wheel parts on the front of the car. High mass ratios are more difficult for the physics engine to solve, so there is a small amount of error in the solve that gets amplified by the Motor attached to the CylindricalConstraint.

The issue can be fixed by increasing the density of the knuckle part, and making it a bit longer:
Racing Car FIXED.rbxl (302.5 KB)

We’ll be sure to update the template soon. Thanks for reporting!

2 Likes

Thank you for taking a look at this!

I am curious on how you debugged the chassis in case I ever need to in the future. Are there any built in tools to detect these high mass ratios?

If not, it could be interesting - especially with the visualization modes recently introduced

Great question!

We have an internal setting in Studio that allows us to visualize constraint forces (we are planning to release this soon). I noticed that the forces on the wheel assembly would grow large and oscillate, which tends to indicate that the solver is not converging.

One of the most common reasons for poor solver convergence is high mass ratios. We use projected Gauss-Seidel in our solver, which converges poorly when the condition number of the constraint system is large. A common source of large condition numbers is high mass ratios between constrained parts. See this great talk from Erin Catto for why this is.

I really like the idea of creating a tool to detect these high mass ratios. It wouldn’t be too difficult, we’d just need to check the assembly mass of any non-anchored assemblies connected by constraints.

Thanks!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.