- Home /
 
               Question by 
               MT_productions · May 02, 2020 at 08:49 PM · 
                rotation3dmovement script  
              
 
              How can make my mouse look working?
So my player is rotating on the X but on the Y it makes nothing.That script was working but when i turned it into a Multiplayer game it wasn't. I have no clue what to do. I have tried everything. Please help me guys...
using UnityEngine; using UnityEngine.Networking;
public class MouseLook : NetworkBehaviour { public float mouseSens = 50; float xRotation = 0f; public Transform playerTrans; void Start() { Cursor.lockState = CursorLockMode.Locked; } void Update()
 {
     if (!isLocalPlayer)
     {
         return;
     }
     float mouseX = Input.GetAxis("Mouse X") * mouseSens * Time.deltaTime;
     float mouseY = Input.GetAxis("Mouse Y") * mouseSens * Time.deltaTime;
    
     xRotation -= mouseY;
     xRotation = Mathf.Clamp(xRotation, -90f, 90f);
     transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
     playerTrans.Rotate(Vector3.up * mouseX);
 }
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                