AlignPosition.RigityEnabled Doesn't Work As Intended

Recently, AlignPosition.RigityEnabled struggles with moving the Attachment0’s object to the destination position.

In the documentation it states that “If true, the physics solver reacts as quickly as possible to complete the alignment.”. Instead the complete opposite happens and takes the furthest path to the alignment as slow as possible working similarly to a magent.

Bug Example.rbxl (53.6 KB) - The place I used in the video.

Reproduction Steps

You can reproduce this by having 2 parts with an AlignPosition inside of the first one with RigityEnabled set to true.

Then put the first part touching the floor and the second anchored above in the air (about 100 studs above the first part) and moved to the side (150 studs away on the X axis).

image

The further away you have the second part the longer it takes to complete the process as the curve size increases and the speed decreases.

We’ve filed a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for flagging!

1 Like

After prototyping several potential improvements for this issue, it looks like we won’t be able to improve this behavior any time soon. At issue here is the behavior of the ‘RigidityEnabled’ option when the part is a large distance from the target. In this situation, we do two things to ensure solver stability: a) We limit the amount of “position correction” we perform in order to move the part to the target when its velocity is zero and b) we formulate the problem about the midpoint between the two attachments. Each of these measures have tangible benefits for other situations but unfortunately lead to pretty unintuitive behavior for this type of situations. At the start of the simulation, the two blocks are not moving so our limited position correction kicks in and moves the blocks closer to one another but doesn’t eliminate the constraint error immediately. Because the constraint error is allowed to persist across multiple frames, the midpoint formulation is able to start affecting the velocity of the blocks, with the constraint acting somewhat like a double pendulum system under gravity. The net result is the path you see in the video. I tried a couple things to alleviate this problem but they either added too much additional energy to the system (causing some mechanisms to be unstable) or prevented the constraint from being satisfied in some situations (such as long, rotating parts). Its possible new solver technology will eventually allow us to revisit this issue but that would be as part of a much larger overhaul of our physics solver. In the meantime, we will revisit the documentation to provide some additional detail regarding what this option is really doing.

For this particular application, if you can tolerate some additional energy being added to the system, your best bet is to use AlignPosition with RigidityEnabled set to false and use a large max force and responsiveness.

Closing as “Won’t Fix” despite my best efforts :frowning: .

2 Likes