Hi, I want my camera to orbit around an object.
Using RotateAround is fine for orbiting left and right like so:
transform.RotateAround (selected.transform.position, new Vector3 (0,1,0),Input.GetAxis("Mouse X")* 20 * Time.deltaTime);
But for going bottom to top it doesn’t work right eg:
transform.RotateAround (selected.transform.position, new Vector3 (1,0,0),Input.GetAxis("Mouse Y")* 20 * Time.deltaTime);
or:
transform.RotateAround (selected.transform.position, new Vector3 (0,0,1),Input.GetAxis("Mouse Y")* 20 * Time.deltaTime);
I even tried mixing and inverting vector values eg:
transform.RotateAround (selected.transform.position, new Vector3 (1,0,1),Input.GetAxis("Mouse Y")* 20 * Time.deltaTime);
transform.RotateAround (selected.transform.position, new Vector3 (1,0,-1),Input.GetAxis("Mouse Y")* 20 * Time.deltaTime);
But the ratation axiz doesn’t seem to work, is there another way to achieve this? PS: I also want the camera to stop at top or bottom positions.
Basically I want the camera to act like in Homeworld 2