I tried writing a script for a first person camera and it kept on saying “MouseX is not set up”
Having absolutely NO idea how to fix this (I’m new) I was just done.
What scripts do you guys use for first person? If you could, please copy paste them so I can use them, or tell me what MouseX is not set up means.
Thank you.
johne5
2
can you post your code.
I assume mouseX is like “Horizontal” or “Vertical”
johne5
3
most beginners use the free unity player controller. you can download it from the asset store. https://assetstore.unity.com/packages/essentials/asset-packs/standard-assets-32351
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlrLook : MonoBehaviour
{
public float mouseSensitivity;
private void Update()
{
RotateCamera();
}
void RotateCamera()
{
float mouseX = Input.GetAxis(“MouseX”);
float mouseY = Input.GetAxis(“MouseY”);
float rotAmountX = mouseX * mouseSensitivity;
float rotAmountY = mouseY * mouseSensitivity;
Vector3 targetRot = transform.rotation.eulerAngles;
targetRot.x += rotAmountX;
targetRot.y += rotAmountY;
transform.rotation = Quaternion.Euler(targetRot);
}
}
You forgot a space for the default settings. Try “Mouse X” and/or “Mouse Y” 