Quantcast
Channel: Latest Questions by Fox-Handler
Viewing all articles
Browse latest Browse all 90

The SqrMagnitude for Input

$
0
0
I've seen this line `speed = new Vector2(h,v).sqrMagnitude;` used a couple times for the parameter in mechanim, but I'm not really sure what it's doing. Could someone explain to me what its doing exactly? void Update () { h = Input.GetAxis ("Horizontal"); //direction v = Input.GetAxis ("Vertical"); //speed = h * h + v * v; speed = new Vector2(h,v).sqrMagnitude; // ?? animator.SetFloat ("Speed", speed); animator.SetFloat ("Direction", h , directionDampTime, Time.deltaTime); }

Viewing all articles
Browse latest Browse all 90

Trending Articles



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