Game Guides > Game FAQ >  

Can you name any uses for dot product or cross product in video games

Can you name any uses for dot product or cross product in video games
The dot product can be used as a half space test. A half space test can be used to determine if an object, lets say a zombie, is in front of the player (or camera) or behind it. If my player's forward vector is P and the vector from the player to the zombie (zombie's position - player's position) is Z, then dotting P and Z would give me the angle between the two vectors. If the angle is positive our player is facing the zombie, otherwise the zombie is behind us (never turn your back on a zombie!).