- Home /
Are bone transforms in LateUpdate the transforms for the next or previous frame?
Hi all,
The Unity documentation says "One important thing to know is that the animation system updates the Transforms after the Update() function and before the LateUpdate() function is called".
My question: if you look at those bone transforms in LateUpdate, are those transform values representing the rendered character in the previous frame or the next frame?
My suspicion is that in LateUpdate, you're looking at old data. I'm driving character movement off the movement of my character root node, and I get glitches during the first frame of each animation.
Thanks, Mattijs
Answer by Paulius-Liekis · Dec 18, 2010 at 08:28 AM
The order is:
- Update() calls
- animation sampling
- LateUpdate() calls
- rendering
So the idea is that you can apply any procedural changes in LateUpdate to your transforms after animation sampling, but before rendering.
Why you have glitches? Hard to say from the given information. My guess is that your code depends on particular order of Update/LateUpdate calls between game objects (the actual order is undefined). Or something like that.
Hi Paulius, thanks for your reply. Yes, that is what the documentation says. I had a problem where, if I called animation.Play() and set the position of the root node to some weird in Update() and read the position of the root node in LateUpdate(), that position was still weird (i.e. it wasn't updated between Update and LateUpdate. However, the rendered frame was fine: the character was at the location defined by the animation, not the weird root node. We have now abandoned root node driven character movement, so I must admit I am less inclined to keep investigating the matter:)
$$anonymous$$aybe you were setting that weird position on some transform which doesn't influence renderer? If that particular bone is not animated it won't be overrider in "animation sampling" step, so what you set in Update is what you get in LateUpdate.
Your answer
Follow this Question
Related Questions
No tranform animation on root bone from maya.mb 6 Answers
2D animation (vertical movement then horizontal) 0 Answers
Wrong rotation while swimming 2 Answers
function behaves unexpectedly inside a coroutine. 2 Answers
In animations, is it possible to only add transform values instead of setting it? 2 Answers