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);
}
↧