Normalized Vectors

I’ve normalized a vector to get a direction between a position and an object, but I’d like to alter the magnitude of the vector again so I can move the object a certain distance towards the position using Translate.

I’ve tried Scale on the direction vector and also multiplying it by a primitive type, but since the magnitude stays the same the Vector doesn’t change. I’ve also tried creating a new Vector3 out of the x, y, and z characteristics of the direction variable, but the magnitude is still 1 (??).

What am I missing?

I’m not sure if this is what you’re after, but here’s what I do to set a vector’s magnitude (distance) without changing its direction:

myvector = myvector.normalized * mydistance;

Weird. The two debug lines here return the same thing (whether direction is normalized or not!):

var stepSize = .2;

function Track (direction : Vector3) {
Debug.Log("normal direction = " + direction);
Debug.Log("distanced direction = " + (direction * stepSize) );
}

:shock:

It works for me as expected (i.e. the second vector is 5x shorter).

A wild guess: maybe you have tweaked stepSize in the inspector and have set it to be one?

It’s always something dumb like that. Thanks, Aras. :sweat_smile: