HELP ME im doing a Mouse look script and I cant figure out the problem with my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float mouseSpeed = 100f;
public Transform playerBody;
float xRotation = 0f;
float yRotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
float mouseX = Input.GetAxis(“Mouse X”) * mouseSpeed * Time.deltaTime;
float mouseY = Input.GetAxis(“Mouse Y”) * mouseSpeed * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
yRotation += mouseX;
transform.localRotation = Quaternion.Euler(xRotation, yRotation, 0f);
}
}
How to report your problem productively in the Unity3D forums:
How to understand errors in general:
Make sure you’re looking in the right place. “Player Look” is not “MouseLook”
If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: Using code tags properly