Monday, February 04, 2013

Collision Detection in Google Earth

Anyone who has ever done any development work with the Google Earth browser plug-in will be familiar with the milk truck game. The Monster Milktruck game has been a prominent part of the Demo Gallery for the Google Earth API.

John Aldridge has now developed the code into a fully playable two player shoot-em-up game, called Zeptoblaster. In the game each player controls their own 3d milk truck and has to hunt down and shoot the other player's vehicle.

The game play takes part in Google Earth's 3d map of the world, including 3d terrain and 3d buildings. Each player also has a handy Google Map which shows the position of their truck and the position of the enemy's truck. Players can choose from a number of battlefields by selecting from a number of pre-defined locations or they can play anywhere in the world simply by using the search field.

One of the most impressive features of this game is the collision detection developed by John, which detects when a player's missile has hit the enemy truck. This collision detection works by creating bounding boxes for the 3d collada models of both milk trucks and for all of the missiles. It is then a simple process of detecting when the bounding box of a missile intersects with the bounding box of a truck (actually it isn't simple and actually involves a very complicated algorithm).

The game needs to load two instances of the Google Earth browser plug-in (one for each player), which can be quite memory intensive, so the game runs best in Google Chrome. 

No comments: