- Home /
Hi, I am new to unity and need help going about moving enemies NPC and attacking the player. thank you
Hi, So I only recently started using Unity. I will have to create a game for one of my assignments in college. im currently designing the game and it is coming on nicely but im having real trouble making enemy NPC move like walking round randomly, then when they see the player they chase after him and attack him. I have made the Npcs in Adobe Fuse and have already rigged hem with the animations. I would really appreciate it if you can help me out ps. i have already made the animation transitions for the enemies.
Answer by Chimer0s · Apr 18, 2018 at 01:46 AM
You add a Nav Mesh Agent component to your enemies then attach a script that tells them where to travel. You could potentially set up a route for them to follow by creating waypoints and having them travel to the positions of those waypoints' transforms, but if they see the player, have them change their destination to the players. A great tutorial for learning to use the nav mesh and its agents/obstacles is this one from Unity. It should clear a lot up and teach you the basics pretty handily.
Your answer
![](https://koobas.hobune.stream/wayback/20220612161008im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
What is the best way to figure out which body part was hit on a rigged character? 3 Answers
Negative raycast direction always returns true 1 Answer
How can I do an enemy damage with different parts of the body? 4 Answers
How to hit two object with one raycast? 2 Answers
growing / feeding NEED HELP!!! 1 Answer