Question by
Guenter123987 · Feb 11, 2017 at 10:01 PM ·
camera-movementcamera movement
Bugfix: 3rd Person Camera
This is my Camera Controller script which is attached to the Main Camera: public class CameraController : MonoBehaviour {
public float mouseSensitivity = 500;
public Transform playerTransform;
void Update()
{
transform.position = RotatePointAroundPivot(transform.position, playerTransform.position, new Vector3(Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0) * mouseSensitivity * Time.deltaTime);
transform.LookAt(playerTransform);
}
public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles)
{
return Quaternion.Euler(angles) * (point - pivot) + pivot;
}
}
My problem is that rotating the camera works first good but then it rotates in a diagonal way when I move my mouse up.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612110901im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Camera drag move 0 Answers
Camera movement feels weird 2 Answers
Camera flickers while chasing the player 0 Answers
How to limit/Clamp RotateAround for camera movement? 0 Answers
Camera bounds with zoomable camera 1 Answer