How to calculate next camera position to look at the object that changed rotation
Hey everyone,
I'm trying to set up my camera so that it always looks at an angle from the top of the object. The problem is my vector maths is a little bit iffy and Im struggling with the concept of calculating both the position and the rotation of the camera so that it always ends up looking at the plane. Now I know I could do that if I attached the camera to the object but that will stop me from being able to delay the camera and provide a nice experience for the user so that they will actually notice the change in rotation.
Any tips about doing that?
The moving object takes into account the movement of the mouse.
I will appreciate all the input.
Kind regards, Gempio
P.S. if my point was a bit vague in explanation I'm attaching a picture so that you can see how I would want to move the camera from the first illustration to the next.
Answer by Magius96 · Feb 29, 2016 at 09:08 PM
What about the LookAt method in the GameObject class? Your drawing makes it look like you're working in 3D space, so that should work, shouldn't it?
It only works for looking at my model from the start... after the update it's not looking anymore plus the position doesn't change based on the rotation of the model.
Your answer
![](https://koobas.hobune.stream/wayback/20220612070104im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Bring 3 Vector 3s together 1 Answer
Maintaining look at target between two cameras 1 Answer
8 Dir Sprites (nearer) 0 Answers
Convert 2D direction vectors to 3D vectors around sphere 2 Answers