com.brackeen.javagamebook.game
Class CollisionDetectionWithSliding
java.lang.Object
com.brackeen.javagamebook.game.CollisionDetection
com.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.
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollisionDetectionWithSliding
public CollisionDetectionWithSliding(BSPTree bspTree)
- Creates a new CollisionDetectionWithSliding object for the
specified BSP tree.
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