control FBX animation

Hi,

I have imported an FBX animation (not a character, but an object). There are 3 things in the FBX file : the mesh, the animation, and an avatar.
I put the FBX in the scene and I have a “Animator” field (I choose the controler and the avatar is already good).
If I let “Apply Root Motion” On, nothing happens when I play.
But if it’s off, my animation is played (one time) at the start of the scene.

I want to play the animation only if I press a key, and I want to reverse the animation when I play the key again (the object comes back at the initial state).
How can I do that ?

Thanks a lot !

Hi @joss51

For the nothing happening when “Apply root motion” is applied maybe you have to set your animations and model to Humanoid if it is a Humanoid character. To do this, click on your animations/models and go in Rig in the inspector and change the “Animation Type” to “Humanoid”.

If you want an animation to loop you have to modify the animation settings, for this just click on the animation and in the inspector check “Loop Time”

Finally if you want the animation to play when you press a key you have to create an “Animation Controller” which changes the current Animation depending on variables in the “Animation controller” and you can change these variables values through script.

Hope this helps :slight_smile: