- Home /
force.normalized * magnitude
If I am right, this script is setting heldObject's velocity's magnitude to 1, * held objects magnitude. Why? What is the point of this?
heldObject.rigidbody.velocity = force.normalized * heldObject.rigidbody.velocity.magnitude
Answer by robertbu · Mar 07, 2014 at 09:21 PM
As an educate guess, I would say someone wanted to make an object turn but keep the same speed. So 'force.normalized' represents the new direction, and 'heldObject.rigidbody.velocity.magnitude' represents the current speed. Put them together, and you get a new direction at the same speed the object was traveling before. Often for games the input for a direction is a finger or mouse swipe. You want the object to turn in the new direction, but you don't want to use the distance the finger was moved to impact the speed of the object. So you normalize the input and then use some other speed factor.