I’m currently doing some basic game design (just a hobby) and I’m using vectors for velocity of objects. I needed the directions of these vectors so I thought to normalize the vectors into unit vectors. That’s when it hit me that I don’t quite understand how you’d apply unit vectors as directions. How does that work when it comes to velocities?
In: Mathematics
your normalized vector (note, normal and unit are not the same) has a direction, and its a vector, so it has a component in the x and y (and maybe z) direction. it also has a magnitude of 1. (lets just use (0.8,0.6) as an example
So if you take it, and multiply it by the speed you want to move, now it has a magnitude of that speed. lets say speed is 10, now the vector is (8,6)
If you take that and add it to the x and y positions of your character it will move that way, so if it started at (0,0) now its at (8,6) and soon it will be at (16,12) etc. That line it is moving on points the direction of your vector, and because you normalized the vector the speed will be the same regardless of direction.
A unit vector is a normal vector used to define a vector space. for games, thats generally just (1,0) and (0,1).
Latest Answers