com.brackeen.javagamebook.game
Class CollisionDetectionWithSliding

java.lang.Object
  extended bycom.brackeen.javagamebook.game.CollisionDetection
      extended bycom.brackeen.javagamebook.game.CollisionDetectionWithSliding

public class CollisionDetectionWithSliding
extends CollisionDetection

The CollisionDetectionWithSliding class handles collision detection between the GameObjects, and between GameObjects and a BSP tree. When a collision occurs, the GameObject slides to the side rather than stops.


Constructor Summary
CollisionDetectionWithSliding(BSPTree bspTree)
          Creates a new CollisionDetectionWithSliding object for the specified BSP tree.
 
Method Summary
 BSPPolygon checkWalls(GameObject object, Vector3D oldLocation, long elapsedTime)
          Checks for a game object collision with the walls of the BSP tree.
 
Methods inherited from class com.brackeen.javagamebook.game.CollisionDetection
checkBSP, checkObject, checkObject, getFirstWallIntersection, getFloorAndCeiling
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollisionDetectionWithSliding

public CollisionDetectionWithSliding(BSPTree bspTree)
Creates a new CollisionDetectionWithSliding object for the specified BSP tree.

Method Detail

checkWalls

public BSPPolygon checkWalls(GameObject object,
                             Vector3D oldLocation,
                             long elapsedTime)
Checks for a game object collision with the walls of the BSP tree. Returns the first wall collided with, or null if there was no collision. If there is a collision, the object slides along the wall and again checks for a collision. If a collision occurs on the slide, the object reverts back to its old location.

Overrides:
checkWalls in class CollisionDetection