I have a enemy, that has a waypoint walking system, and i want it to patroll at each way point stop.
So i have some flags, that tells if hes walking or patrolling. If he's walking it will call the walkingscript, otherwise it will call the patroll script. I have a problem with de patrol script.
I want the patrol script to turn my robot to his right, around 90 degrees and then turn around 90 degrees do his left, all from the start position he was facing.
Any ideas of how to make this work?
function PatrolAtStop(position, angle)
{ lastRotation = position.forward;
if (angle < 60) {
transform.Rotate(0,Time.deltaTime * 20, 0);
anglePatrolled = Vector3.Angle(lastRotation, transform.forward);
}
if (angle >= 60)
{
patrolling = false;
anglePatrolled = 0;
}
}
Its not working