Hi, there is lots of this information in unity and I have been researching it tonight. I didn’t want to copy and past code and attach targets but instead write it line by line so I understand what is happening and test as I go. The one area I got stuck in was how to make the zombie turn slower? When I try and run around behind it, it turns at the same pace I do.
My Update() code.
void Update () {
Vector3 sPoint = new Vector3(0f,0f,speed); // create a slow speed moving towards target
transform.Translate(sPoint); // This moves zombie the script is attached to.
// bellow uses the player X and Z to point at the player. The Y is self, so it won't rotate in that axis
Vector3 targetPostition = new Vector3( target.position.x, transform.position.y, target.position.z ) ;
transform.LookAt( targetPostition ); // this function tells the zombie to look at the player.
I believe this has to do with the Quaternion.Slerp() but I can’t seem to wrap my head around this idea, can anyone shed some light on that subject?
Thank you.