Skinned model animation starts in T-pose for one frame
Issue description:
I'm spawning a prefab, with a single animated model as root. The model is a character imported in T-pose. It has an animgraph that always outputs a looping animation. When playing the game in the editor, the character is spawned, but it flickers from t-pose once on spawn, before it plays the animation normally
Steps to reproduce:
- Import an animated model with looping animation.
- Create a prefab with this model. Set the model as root and delete the empty.
- Create an animgraph and drag the animation in it.
- Connect the animation to the output.
- Set the animgraph for the model in the prefab
- Write a simple script that spawns the prefab over and over again to make it easy to spot. (included in the repro project)
Minimal reproduction project:
Flax version:
1.7.6407.2 (master on jan 06)
Workaround I found is to hide the model for one frame, the next frame it will work. Setting the model's DrawModes to None, and then back to All. This only works if DrawModes is only restored to All in the second OnUpdate call. Doing it right in the first one doesn't help.
We could add option to specify how the actor should handle this:
- run initial Anim Graph update on the begin play to have initial pose (might lack gameplay data from scripts),
- don't draw model until initial animation update kicks in,
- ignore and use the current logic.
If it can be made possible to update the anim graph for the initial pose, could it be done with a call to a function? For example on OnAwake or OnStart. Then it would be up to the game dev whether they use it or not. If the initial animation needed gameplay data, they could opt-out and just hide the model manually.
Even changing the model, sometimes the same thing will happen.