Back to Browse

UNITY - Simple Movement W/ Mouse in 5 lines

243 views
Nov 18, 2018
1:20

I spent days trying to figure out 5 lines of code... here it is for you to enjoy and use. Walk forward and look around. Code bellow: void Update () { if (input.GetKey("w") == true) transform.Translate(0, 0, .07f); float mousemovement = input.GetAxis("Mouse X"); Vector3 look = new Vector3(0, mousemovement, 0); transform.Rotate(look); } You can change your mouse sensitivity by going to your input manager and changing the sensitivity for the Mouse X to a value of "1".

Download

0 formats

No download links available.

UNITY - Simple Movement W/ Mouse in 5 lines | NatokHD