I am lost in how that part of the video works and why we needed to take that additional steps. The video, to me at least, wasn’t very clear.
Hello Molderr,
Vector2Normalize takes a vector and sets its magnitude (sometimes referred to as length) to 1. For example, a Vector2 of (1.0, 1.0) when normalized would instead become (1/sqrt(2), 1/sqrt(2)). I wont get into the particulars of the math for how this works, but here’s an article that talks about it.
Vector2 examples like that are the reason we do this for, as a Vector2 of (1.0, 1.0) would be generated when you try to move diagonally. And if we left it alone when we tried to move then we’d actually move faster than if we moved directly down/up or left/right. The cool part is that trying to normalize a Vector2 like (1.0, 0.0) or (0.0, 1.0) would return the same vector, as their length is already 1.
So to summarize. We use Vector2Normalize to make sure we work with vectors that allow us to move at a constant speed regardless of the direction of movement.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.