Render and update sequence

I’m sure this is fully documented somewhere but I’ve been unable to find it, apologies if I’m missing something glaringly obvious!
What is the render and update sequence (order) in PlayCanvas?
Is the rendering on the same loop as the scripts, or separate? (Do we get exactly one update per render frame?)
Is the GLTF animation system on the same loop? (One animation update per script update?)

The reason I ask is I’m using an animated camera path exported as an FBX, controlling the animation speed to make it move at a user controllable velocity and stop at certain scene event timings.
The speed takes it past the event time (it steps across the exact time value) so I reset the activeStateCurrentTime to the desired precise value.
What I’m seeing is that there is sometimes a visible step backwards when this occurs.

I have started to replace the animComponent.speed with a code driven internal variable to track the current time, which will be set into the animation at the end of each update loop.
What I am concerned about is whether this might result in a more jerky animation (if the animation system is on it’s own loop which fires faster than the script updates).

Here’s a life cycle:

Basically, each frame:

  • an update is called on all scripts (ScriptType.update)
  • then all anim components get updated (AnimComponentSystem.OnAnimationUpdate)
  • and lastly postUpdate is called on your scripts (ScriptType.postUpdate)
  • rendering takes place after this

So it’s likely you want to do your time clamping inside postUpdate - which is after the animation system updated it, but before it’s used for rendering.