Hi,
I was trying to make a camera rotate like while using MouseLook script in the standard assert and I want a player can press a button to snap( LookAt ) a target in screen(First person view) while using MouseLook.
The problem is the MouseLook Script use quatenion to rotate in the following script
Code:
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationX = ClampAngle(rotationX, minimumX, maximumX);
rotationY = ClampAngle(rotationY, minimumY, maximumY);
Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
Quaternion yQuaternion = Quaternion.AngleAxis(rotationY, Vector3.left);
FPSCamera.transform.localRotation = originalRotation * xQuaternion * yQuaternion;
and I try to use
Code:
FPSCamera.tranform.LookAt(target);
The thing that happen was my camera lookat target but the MouseLook still use the rotationX and rotationY that sum from before and try to wrap my camera back to where it was before using LookAt.
I know this would be a newbie question but How can I do this to make it get along together?
Thank you