- Home /
Need help implementing a zoom function
I'm trying to implement a zoom function on my camera and need to have the camera look at a specific point (the mouse position) when scrolling in. Let's say the camera needs to look at point B over a period of 5 scrolls. So calling LookAt(B) won't necessarily work.
To get the point to look at, I created a ray from thecamera's position to the mouse's world space position. I calculated bisections between the camera's forward and the ray to get different target directions so that each scroll would have the forward move towards that direction.
But I need to clamp the rotation between some values and by just setting the forward, I'm not able to get any of that until after the move. Iis there a way to find the euler rotation values before setting forward = targetDirection?
I've also tried calculating the angle between the two vectors and crossing the two to find the axis and converting to euler but no luck. The values would be incredibly small and give me 360 degrees.
Your answer
Follow this Question
Related Questions
How Can I Stop Rotation From This Script? 0 Answers
Look at wont update? 2 Answers
My character suddenly stopped looking up/down 0 Answers
How to rotate bone relative to camera using LookAt 3 Answers