How to move object from existing position to new position and change its animation?

Hello. This is my first time asking a question. I’m still a Unity newbie but have been a developer for years. I’ve spent hours trying to figure out how to successfully perform what I would think would be a simple task and, no matter what I’ve tried, it hasn’t done the trick. I would post some code but I have nothing that is working.

Here’s what I would like to accomplish. I have a room with a monster object in the far corner. I have a trigger in the doorway. When the FPC walks into the trigger I want the monster object to move across the room to a point in front of the door and stop. At that point I want to change the monster’s built-in animation to change from it’s “run” animation to it’s “attack” animation. That’s it. Move from point a to point b while running. Stop at point b and switch to the attack animation.

That’s it. Nothing fancy but it’s driving me crazy. I’ve spent hours working with different lerp examples, move examples, translate etc. I can get the monster to move correctly using the animation editor, but I don’t know how to switch the animation from “run” to “attack” when it reaches the destination from within the animation window.

Thank you in advance to anyone who can offer some insight and guidance. Have a great day!


Use mecanim animation system.You can learn here -
you can keep a transition from idle to running at pt A.
Then you can trasform.translate to pt.B.
keep another trigger enter at B.
Here again you can create a transition using trigger enter to change the float.
hope the guidelines help.I am a newbieas well. you will be able to use mecanim after u see the 50min tut by unity…if u have any probs with triggers ortransform.translate u can refer youtube vids or API.