- Home /
Transform.LookAt
I know how transform.LookAt function works. It looks at the transform position that we input into. How do I code to show the movement it made to look at the position? I don't want it to look at it directly after a button click.
Answer by Visual Programmer · Sep 25, 2013 at 10:52 AM
For that, you'll want to use Rotate instead of LookAt.
Now I have more time I will explain better. You will need to find the angle between the two objects then use transform.Rotate to smoothly rotate towards that angle.
Answer by ArkaneX · Sep 25, 2013 at 11:29 AM
Please take a look at SmoothLookAt script in Standard Assets\\Scripts\\Camera Scripts.
The SmoothLookAt script is not what I am really looking for. In that script, they move the camera rotation I want it to move like a 2D pattern which means only the position of the camera changes and I want to see the movement.
I'm sorry but I don't understand what you need then. Your question was about LookAt, and LookAt only changes the rotation, nothing else. No position moving is involved.
If that's what you're going for, just attach it to a gameObject. That way, whenever the gameObject moves, the camera follows it.
Your answer
Follow this Question
Related Questions
why ragged ( not smooth) movement....hlp plz 1 Answer
How Can I Create a Button that Takes Multiple Objects and cycles them through a grid? (Unity 2D) 0 Answers
How do I make an object in game face the direction it's traveling while viewing from above? 1 Answer
Networked position interpolation implementation (not Dead Reckoning)? 1 Answer
Help!How to validate the client position in headless unity? 0 Answers