Game Development Reference
In-Depth Information
In a game a 3D plane might be positioned somewhere to signify a change; if the
player crosses this plane then he has finished the level, or a boss should spawn, or
he has fallen to drown in the sea. The test to see which side a player is on goes
like this.
Create a vector from the plane position to the player position.
Dot product the plane normal with the newly created vector.
If the result is zero, the player position is exactly on the plane.
If the result is above zero, the player is on the normal side of the plane.
If the result is below zero, the player is on the other side of the plane.
This test can be seen graphically in Figure 8.15.
Figure 8.15
Player and plane position.
 
Search WWH ::




Custom Search