Model.WorldPivot returns incorrect value (!~= Model:GetPivot())

Reproduction Steps

In the DEMO place:
DEMO.rbxl (35.6 KB)

  1. Run place
  2. Script in workspace makes a model start falling.
  3. Script will error if the falling model’s .WorldPivot is far from its :GetPivot().

Expected Behavior

I expect a model’s WorldPivot property to be near the value returned by calling model:GetPivot()

Actual Behavior

model.WorldPivot returns the model’s pivot before any physics moved the model.

Workaround

model:GetPivot() works.

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Constantly

1 Like

Thanks for the report! We’ll follow up when we have an update for you.

1 Like

Not a bug.

WorldPivot is not updated when the object moves due to physical simulation because doing so would be excessively expensive for complex moving objects. If you want to know what an object’s pivot is you should always call GetPivot().

If you were hoping to listen on WorldPivot changed as a backdoor way to get around CFrame not firing changed events during physics simulation, nice try, but that won’t work. The bottom line is that you need to use some form of loop to process position changes thanks to simulation, not changed events.

Actually I was wondering what was the difference between reading WorldPivot and GetPivot(). I was about to replace GetPivot() with WorldPivot as it seemed less expensive. Good you clarified, I would
recommend adding this note to the documentation

C++ Method calls and C++ property access have a very similar cost, they’re effectively exactly one function call either way. As for those two in particular… yes, GetPivot is very slightly slower… but because that’s exactly because its doing extra work to always do the right thing.

WorldPivot should only be used when you’re trying to actually adjust where on the model the pivot is.

2 Likes

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