Questions about Vector unit

when to use Vector Unit? I see some code has .Unit on it

The documentation: Vector3.Unit

A normalized copy of the Vector3 - one that has the same direction as the original but a magnitude of 1.

Useful when you want to normalize and set your own magnitude but keeping the direction.

2 Likes

I don’t get it, can you give me example for unit?

A unit vector is basically just the direction of a vector from the origin (0, 0, 0).

I will be using Vector2 for this, but it is the same as Vector3, just with less ordinates (values)

A vector of (3, 4) would have a unit vector of:
(3, 4)/5
or an x value of 3/5, and a y value of 4/5.

The 5 is the magnitude of the vector, given using pythag (a^2 + b^2 = c^2).