- Home /
Multiply by a magnitude
I want to return a number using this line of code:
Debug.Log(temp * verticalMove.magnitude);
temp is = 1.
But when I run this line, it lists 1. I want it to list a different number based on the speed that you are moving in the y direction. This is the whole block of code:
if(verticalMove.magnitude > triggerFall)
{
verticalMove = verticalMove.normalized;
Debug.Log(temp * verticalMove.magnitude);
}
Comment
Best Answer
Answer by AlucardJay · May 13, 2013 at 03:32 AM
A normalized vector returns a vector with a magnitude of 1, that's what normalize does.
http://docs.unity3d.com/Documentation/ScriptReference/Vector3-normalized.html
You want to use the magnitude of the verticalMove before you normalize it.
speed = distance / time;
speed = verticalMove.magnitude / Time.deltaTime;