The world position is not immediately updated. You will be able to read the new world position after all transforms have been updated which I believe happens after the update() step of a frame. @Sven can probably tell you more.
Yeah, I understand that it’s a performance concern to update transforms extra times, but I would still expect it to be recalculated when I call go.get_world_position(), so I get the correct result.
Since it happens after update() (and after messages sent on update() it seems), is there any way of accessing it? The render script update happens after, but it doesn’t have access to go. functions, so that’s not helpful.
As you point out; the reason it isn’t updated directly is to avoid making multiple transform calculations each time a gameobject position/rotation/scale is updated. Instead this is done in one swoop, over all the instances in the collection.
However, @britzl could be on to something, it might possible to send a message to the same script which should be handled directly after the update.
Ah! Interesting. In my case I’m already doing some calculations “post-update” with this method, so I didn’t notice the difference. Thanks, this helps!
And I guess the transform is updated again afterward, since setting the object’s position in that message response works just fine. (this DefoldCodePad thing is very cool btw.)
Assuming this behavior won’t be changed anytime soon, I’ll make a suggestion on the doc page so other people don’t have to find it out the hard way.