- Home /
How to make an enemy stalk you
Hi, Im redoing my game because I upgraded to unity 4.0 and it deleted all of my scripts from the last game. Right now Im trying to get a script that makes the enemy always look at you and and follows more persistently as each page is collected. If someone could give me a script for this Id really appreciate it. Thanks.
I can give you a script where the enemy always faces just to the left of you. And follows you really casually, like they could care less you're even alive. But they're sorta waiting for you to get hit by a car, so they can rifle through your pockets while you are helpless and injured.
This sounds scarier really.
Answer by Berenger · Nov 26, 2012 at 08:15 AM
Give you a script, yeah, no. But hints and directions !
First, you have to separate how to move your character, then where to move it. For the first part, you can import the character controller package. For the second part, there is the orientation (transform.LookAt) and the direction (target - currPos). But this will move your character on a straight line, and I suspect there is trees in your game. You could do a simple avoidance as trees are kind of particular (circular, limited radius) or, more difficult, pathfinding.
As for the degrees of efficiency to rise up as the player progress into the game, you can play on the speed of the enemy maybe ? Then again, I never played slenderman myself.
This site is to help you solve your problems - if you want someone to solve your problems for you (which is different), you'll want to look in the Collaboration section of the forums.
Your answer
Follow this Question
Related Questions
Navmesh follow and stop at a distance 2 Answers
Enemy is not stopping following the player 2 Answers
Enemys following and shooting 1 Answer
make enemy attack 0 Answers
AI Following Problem 1 Answer