- Home /
trouble with my lookAt script
I am trying to clean up some issues im having in my game.
I use this script on my turret body it recognizes when the player gets in range, however the turret is reversed when i moves and looks at the player. So its the back of the turret that actually follows the player. How do i fix this?
var target : Transform; var range : float; var speed : float;
function Update () { range = Vector3.Distance(target.transform.position, transform.position); if (range<200) { transform.rotation = Quaternion.LookRotation(transform.position - target.position); } if (range<150) { transform.Translate(Vector3.forward*speed*2); } }
Your answer
Follow this Question
Related Questions
turret AI question 3 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Trouble with turret script 1 Answer
Coordinating multiple AI enemies 3 Answers
How to make basic AI in a 2d game? 4 Answers