I have enemies with ai’s that follow you around but the enemy can basically walk up any slope no matter how steep. How can I stop it from doing this? Also sometimes whenever they hit a wall or something they go awol and just start running in random directions. by the way i got this script online and have no idea what im doing with it (sorry for my noobishness)
#pragma strict
var Player : Transform;
var MoveSpeed = 4;
var MaxDist = 10;
var MinDist = 5;
function Start ()
{
}
function Update ()
{
transform.LookAt(Player);
if(Vector3.Distance(transform.position,Player.position) >= MinDist){
transform.position += transform.forward*MoveSpeed*Time.deltaTime;
if(Vector3.Distance(transform.position,Player.position) <= MaxDist)
{
//call function here
}
}
}
okay thanks :) for that. I was just daunted because I have 0 experience with using code to move objects.
– ReafyDon't worry bro, we've all been there, I've been using Unity for almost a year now, and I'm still learning basics lol.
– N1warheadSo what is NavMesh?
– Reafyactually i just googled it and set it up. Now it works great :D
– ReafyRemember to mark the answer as accepted rather than just adding solved to the title ![alt text][1] [1]: http://answers.unity3d.com/storage/attachments/27269-howtotickananswer.png
– Scribe