Vector Versus Scalar

Whenever you introduce a quantity in your game, you must distinguish whether it's a vector quantity or a scalar quantity. The difference between the two lies in the direction.

You've been working with scalar quantities since you learned to count. A scalar is just a number; sometimes it's called a magnitude without any direction. A vector quantity has both magnitude and direction. For example, suppose your friend is having car trouble, and he calls and asks you to come pick him up because he's only 2 miles away. You say no problem and hop in your car. But how will you find him? If he had said 2 miles due east on your street, you might have had a better chance of locating him. That's the difference between vectors and scalars. ...

Get Beginning Math and Physics for Game Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.