Animation not working for NPC while random movement on NavMesh

Hello

I just created my first NPC - a rat. The rat is moving randomly on the NavMesh. While the rat is moving, the “Walk” animation should be playing. Unfortunately this is not the case - the rat is moving correctly, but the animation doesn’t run. And I cannot figure out what I have made wrong :frowning:
My code and the related components are attached. Does somebody see the problem?

Thanks

Huxi

Hey I'm not sure, but try setting the avatar of your animator. At least that worked for me

1 Answer

1

Alright i got it to move, but its really an elongated rat now. I think the model/armature still has some issues.

What I did was to export the object from blender as an .fbx. You will have to generate the avatar in unity, simply go to the .fbx file → rig → avatar definition: create from this model.

Then select the root node (I think its Armature/Head/Neck/Root) and click apply.

Create a new GameObject with your rat, add an animator, set the controller and the newly applied avatar. In the Animator Controller (double click to open the interface) you can create a new state and set the motion to be the walking animation. Then just point the entry to it and you are done, maybe your rat will not look like a hotdog

I already had problems with animations from blender files in the past. I don't know why, but it seems to me, that unity cannot work with models, which have animations and are imported from an .blend file. And to this hotdog :). I've seen it before and I am not the only one with that problem: https://forum.unity.com/threads/blender-animation-causes-mesh-to-stretch-in-unity.157131/ So I don't think that there is something wrong with the model itself. I will make a bug report for unity. For me it looks like a duckel :) So, but thank you, I will try it with the fbx file.