Quantcast
Viewing all articles
Browse latest Browse all 2891

How do I get first person controls to work?

I'm working on a first person game and have been following [this tutorial][1] to learn how to do it. I have all the code correct and have everything set up correctly as far as I know, but I'm still getting the error message "ArgumentException: Input Axis MouseX is not set up. I suppose I will also have this problem (after the mouseX one is solved) for Mouse Y. Here is my code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class MouseLook : MonoBehaviour { public Vector2 mouseLook; public Vector2 smoothV; public float sensitivity; public float smoothing; GameObject character; void Start() { Cursor.lockState = CursorLockMode.Locked; character = transform.parent.gameObject; } void Update() { Vector2 vct2 = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); smoothV.x = Mathf.Lerp(smoothV.x, vct2.x, 1 / smoothing); smoothV.y = Mathf.Lerp(smoothV.y, vct2.y, 1 / smoothing); mouseLook += smoothV; transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right); character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, character.transform.up); } } and a screenshot of the input settings: ![Input settings][2] Does anyone know how to solve this? Thanks! [1]: https://www.youtube.com/watch?v=blO039OzUZc [2]: /storage/temp/173885-screen-shot-2021-01-08-at-40413-pm.png

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>