Hello everyone,
I’m trying to create a camera controller similar like the Blender navigation camera, so the camera will panning in the space with the click of mouse, will rotate on click of the mouse and zoom toward the mouse.
I’m trying to create it for days, but I can’t figure it out how to do it. Can anyone help me?
Personally, I think the easiest way to think of most of these operations is in terms of the camera’s transform’s forward, up, and right vectors.
To move the camera forward and backwards, you add or subtract its forward vector from its position. To move left or right, you add or subtract the right vector. To move up or down, you add or subtract the up vector. To rotate (roll) the camera, you want to rotate it around the forward vector.
Most of these operations are as simple as something along the lines of
// for moving the camera forward and backwards (what I believe you referred to as zooming, but zooming is actually changing the field of view)
camera.transform.position += camera.transform.forward * Time.deltaTime * someScaleFactor;