Search Unity

Resolved my Camera not rotating on the X axis since i installed the input system

Discussion in 'Input System' started by Deleted User, Feb 19, 2023.

?

What should i do

  1. Go back to input manager

    0 vote(s)
    0.0%
  2. Stare at my screen

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. Deleted User

    Deleted User

    Guest

    Look at title code is here
    MouseVector is a vector2 btw

    Code (CSharp):
    1.     private void MouseLook()
    2.     {
    3.         float mouseX = mouseVector.x * mouseSensitivity * Time.deltaTime;
    4.         float mouseY = mouseVector.y * mouseSensitivity * Time.deltaTime;
    5.  
    6.         xRotation -= mouseY;
    7.         xRotation = Mathf.Clamp(xRotation, -90f, 90f);
    8.  
    9.         cam.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
    10.         transform.Rotate(Vector3.up * mouseX);
    11.     }
    12.  
    13.     public void OnLook(InputValue value)
    14.     {
    15.         mouseVector = value.Get<Vector2>();
    16.     }
     
    Last edited by a moderator: Feb 19, 2023