When changing the position of a GO, you can get the position on the next line, and it will be updated. But if you get the world position of the GO, it’s not updated until the next frame. Why? I would assume it’s for performance reasons / to ensure all actual transforms happen all at once?
Would it be reasonable to add an option to force updating the world position of a GO when updating its position when this is useful? So then probably also update any GO world positions that it is a parent/child of.
go.set_position(vmath.vector3(100,0,0), "my_object", {update_world_transform = true})
Or a function to force update the world transform of a GO.
go.update_world_transform("my_object")
I remember other people in the past having grief over world transforms not being immediate.
This thread has a few explanations for why it isn’t done immediately.
If updating a specific GO transform isn’t reasonable then maybe giving control over when to do extra updates of all transforms would be useful.
go.force_update_transforms()
– immediately update all transforms of the current collection / world the GO is in
The thread also has a code sample from @sven showing that in the life cycle the transforms are handled by the time the message queue is processed so you can send a message to a script from itself in its update to do steps that rely on the new transform.