Physics simulate before Weld Constraints can take effect, causing random offsets

While creating a weld script for a friends project, I’ve had a script run through a list of objects inside of a ship and create a weld between neighbouring parts.

This is the outcome of said module with all the parts anchored which is expected.


as you can see the welds have all be connected but none of them are active because the parts are anchored.

Now adding an extra function to set the Anchored value to false for all the parts except a core part after they have been welded causes some offset issues

Unless I’m being oblivious to a mistake I’m making or welds don’t quite work how I understand them I’m going to say that this is a bug with how the engine is running a physics step before actually welding the parts, as my assumption is once they are unachored they shouldn’t move.

Place Repo:
Weld_Test.rbxl (29.9 KB)

At the bottom of the WeldShip module (screenshot slightly modified from repro), consider the following:

image

  • (Uncomment Line 123) When the blocks are unanchored before the model re-enters workspace, parts are significantly offset. In this case, it looks like physics get simulated before constraints can take effect.
    image

  • (Comment line 120 + Uncomment line 123) If the model never leaves workspace, the part offset is significantly less but still visible. It looks like by the time physics simulates on the now unanchored blocks, the weld constraints nearly haven’t taken effect; the delay between constraints activating and the model being unanchored appears shorter than the previous case since the offset is less.
    image

  • (Uncomment Line 126) When the blocks are unanchored after the model re-enters workspace, there is also minimal part offset. Constraints took effect nearly before physics were simulated.
    image

This possibly points to a race condition with physics step vs. (weld) constraints.

This topic was automatically closed after 6 minutes. New replies are no longer allowed.

A post was split to a new topic: Physics simulate before Weld Constraints can take effect, causing random offsets