How to use a unit vector

What I understand is that a unit vector is just a vector with its length set to 1.
image
If I multiply it I can make it longer.
image
But how would I use this? How would I find the end of this?
image
Or am I not thinking of vectors correctly?

1 Like

That’s exactly what a unit vector is. It’s a direction scaled down to a length no greater than 1.

LookVector, for example, is a unit vector. You can multiply it by the length that you want.

ball.Velocity = somePart.CFrame.LookVector * SPEED

If LookVector was not a unit vector, the ball would go out of control despite what you multiply it by, because the direction vector would be way too large.

but if I multiply a unit vector it becomes longer no?

and if it can do that theres a end right

I recommend you watch this video for a better understanding about the various ways you can interpret vectors:

4 Likes

Yeah it becomes longer. There’s no definite endpoint to a direction, it’s just a direction vector.

What are you trying to do exactly?

1 Like

Like find try to find that end point or is that really misguided

The vector itself is the endpoint
A vector is defined as a line from 0,0,0 to x,y,z, so x,y,z is the endpoint

1 Like

actually I should rephrase my question how would I travel in this direction?

You’re thinking of vectors wrong. I’ve never been a fan of showing them as lines. A vector is simply three numbers. You can use those numbers to represent different things.

Often, a vector will represent a position in 3d space. This is easy and intuitive and you already understand it.

A unit vector represents a direction. It is important to understand that this direction doesn’t have any associated position.

The question “how do I find the end of the unit vector” simply doesn’t make sense because the unit vector isn’t actually placed anywhere in space. This is not an issue with the problem you’re solving, it’s an issue with the semantics of the question. What you really want to ask is “given a position, how can I find the end of a unit vector?”. Once you phrase it this way the answer becomes obvious; the end position is simply position + direction*distance.

2 Likes

I mean you could use countless things to move it in a direction using a vector
position = position + direction
force = direction
velocity = direction
etc
It would depend on what you want to do

1 Like