Go.set_position lag?

red_blue_ball_GIF

I have an object1 whose position changes with go.animate. In the update, object1 sets the position of the object2. As a result, the object2 lags behind the object1.

3 Likes

I believe go.animate is calculated/updated in the “post update phase” but before rendering but surely someone in Defoldteam can confirm it

1 Like

Defold team, also please explain at what moment physics is updated and sends messages to the game objects? After/before “update phase” or…?

1 Like

The update loop is documented here: https://www.defold.com/manuals/application-lifecycle/#_the_update_loop but it probably needs to be clarified. Physics is updated after scripts if I’m not mistaken @sven?

Yup, that is correct. :+1:

What do you have to say about the subject?
What to do with the lag?

I’d say don’t use go.animate this way. You can use pure Lua tweening library like flux and assign all objects positions at the same time.

You can also use go.set_parent()

1 Like

Did I get it right that this is the order of “update”:

  1. Calling “update” in all scripts
  2. Dispatching messages
  3. Updating physics
  4. Dispatching messages (due to physics)
  5. Updating go.animate animations
1 Like

Almost:

DispatchMessages() is called between the update of each component type.

And the update order for the first types are:

  • script
  • anim
  • gui
  • physics
7 Likes