Hi,
I currently have my camera looking at a target using LookTo(). I need to be able to adjust the rotation of the camera based off mouse mouse movement. Basically, I want the camera to look at a target, but the user can move the mouse to look around that target. I don't want the camera to move, just rotate a certain degree to the left/right, up/down, while still facing the same target.
Here's what I have to rotate the camera based off mouse movement. This works for rotation based off mouse move, but since I'm setting the lookTo towards the mouse, I'm losing the desired camera direction.
I'd greatly appreciate some help! Thanks.
void RotateCamera(Vector2 input)
{
if(isRotateCamera)//only rotate if camera is not moving along path
{
Vector3 MouseWorldPosition = camera.ScreenToWorldPoint(new Vector3(input.x, input.y, 100));
//apply rotation to camera
MouseWorldPosition.Normalize();
transform.LookAt(MouseWorldPosition * 20, transform.position);
transform.rotation = Quaternion.Euler(new Vector3(transform.eulerAngles.x, transform.rotation.eulerAngles.y, 0));
}
}