Skip to content
Snippets Groups Projects
Commit efbca4f2 authored by kelvinra's avatar kelvinra
Browse files

fix: player look

parent 48d928b1
Branches
Tags
3 merge requests!78RELEASE,!43Feat/sprint,!30feat: import models
...@@ -11,6 +11,8 @@ public class PlayerLook : MonoBehaviour ...@@ -11,6 +11,8 @@ public class PlayerLook : MonoBehaviour
public float xSensitivity = 30f; public float xSensitivity = 30f;
private float ySensitivity = 30f; private float ySensitivity = 30f;
public Transform joint;
void Start() void Start()
{ {
Cursor.lockState = CursorLockMode.Locked; Cursor.lockState = CursorLockMode.Locked;
...@@ -25,6 +27,7 @@ public class PlayerLook : MonoBehaviour ...@@ -25,6 +27,7 @@ public class PlayerLook : MonoBehaviour
xRotation = Mathf.Clamp(xRotation, -80f, 80f); xRotation = Mathf.Clamp(xRotation, -80f, 80f);
yRotation += mouseX * xSensitivity * Time.deltaTime; yRotation += mouseX * xSensitivity * Time.deltaTime;
transform.localRotation = Quaternion.Euler(xRotation, yRotation, 0f); transform.localRotation = Quaternion.Euler(0, yRotation, 0f);
joint.transform.localEulerAngles = new Vector3(xRotation, 0, 0);
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment