- Home /
transform.LookAt issue
So I'm making a tower defense prototype and I want my turret to look at a specific object and I've made it so also, but the problem is that it inverts the angle so it's the exact opposite of what it would be and this is really frustrating and I'd really like your help with this.
For example, the original look direction would be: >, then it turns into < but mine is actually on this axis \ so it's hard to show.
Here's my script:
var Target : Transform;
function Update () {
transform.LookAt(Target);
}
It looks like the transform.forward
of your model isn't as you would like it to be. The cleanest way would be to change your model, but there are some quick fixes depending on what you mean by "the exact opposite". If it's looking backwards, you could just add this line after transform.LookAt(Target);
transform.forward *= -1;
Answer by Juice-Tin · Jun 30, 2014 at 02:29 AM
If you have this problem frequently and really don't care to adjust lots of code you can also put your Tower inside of an empty game object, face it the right way, then have the gameobject do LookAt in the code.
Your answer
Follow this Question
Related Questions
Get slerp to work just as LookAt(,Vector3.right) does 1 Answer
How to make an enemy look at you and follow you 0 Answers
Hello, Need some help with Enemy facing the player on z axis !! 0 Answers
transform.LookAt boundaries 1 Answer
Using LookAt method to get object X rotation to face another object 1 Answer