I currently have some animations that are generated at runtime, which include transform movement either on the root game object, or on a root note parented to the root game object. (The root game object does not move in the latter case)
In editor there is the Generate Root Motion button, however I can not find a way to achieve a similar result at runtime. The following post suggests that you can apply curves to Animator.MotionT and Animator.MotionQ which will make the engine treat it as root motion, however this does not work for me and shows that the Animator.MotionT/Q properties are missing.
Has anyone got any suggestions to make this work? I’m using the latest version of Unity (5.6). At this stage I am most likely going to use the legacy Animation component, read the 7 position and rotation curves (For every clip) into a monobehaviour, and evaluate them from there, which seems somewhat unnecessary.
Thanks for the reply, though I was able to get it to work with the Animator component by using Resources.Load to load an existing Animation Controller with a bunch of empty clips with the same name as the runtime generated clips, and then creating an Animation Override Controller in script, applying it to the animator and applying the overrides to it. Apart from the root motion, it worked fine.
It works in the editor (because we need to be able to edit clips in the editor), but it won’t work if you make a build in a standalone player and try to generate clips there.
Ah, I see. I didn’t realise this as I was only testing in the Editor, but I wasn’t using any Editor classes so assumed it would work.
Are there any plans to allow for runtime generated (non-legacy) animations/root motion in the future? The Unity docs say that all legacy animation features will eventually be migrated into the new animator component, I assume this would include being able to generate animations/set curves at runtime.