physics3d
Class OldGamePhysics

java.lang.Object
  extended by physics3d.OldGamePhysics

public class OldGamePhysics
extends Object

OldGamePhysics is an immutable class with static methods that does physics calculations. OldGamePhysics does some things better than GamePhysics but does not have as many features, such as calculating collisions between balls.


Constructor Summary
OldGamePhysics()
           
 
Method Summary
static boolean farther(GameObject ball, GameObject canidate)
          Given too game objects, ball and canidate, father will return true only if ball is getting closer to canidate.
static void freeMove(Ball ball, double time)
          Move the given ball for the specified amount of time, under only the influence of gravity and air resistance
static List<GameObject> moveBall(Ball ball)
          Move the given ball.
static PhysicsShape nextShape(Ball ball, List<GameObject> candidates, double timeleft, List<GameObject> collisions)
          Return the closest PhysicsShape that this ball will collide with in the next timeleft seconds.
static List<GameObject> willCollideWithBound(Ball ball, Set<GameObject> objects, double timeleft)
          Returns those GameObjects where the ball will collide with their bounds in the next timeleft seconds.
static PhysicsShape world(PhysicsShape p, GameObject o)
          return p in the worldspace of o
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OldGamePhysics

public OldGamePhysics()
Method Detail

moveBall

public static List<GameObject> moveBall(Ball ball)
Move the given ball.


willCollideWithBound

public static List<GameObject> willCollideWithBound(Ball ball,
                                                    Set<GameObject> objects,
                                                    double timeleft)
Returns those GameObjects where the ball will collide with their bounds in the next timeleft seconds.


nextShape

public static PhysicsShape nextShape(Ball ball,
                                     List<GameObject> candidates,
                                     double timeleft,
                                     List<GameObject> collisions)
Return the closest PhysicsShape that this ball will collide with in the next timeleft seconds. If it will not collide with any PhysicsShape, null

Returns:
a physicsshape set in WORLD SPACE, or null

freeMove

public static void freeMove(Ball ball,
                            double time)
Move the given ball for the specified amount of time, under only the influence of gravity and air resistance

Effects:
ball.velocity, ball.position

world

public static PhysicsShape world(PhysicsShape p,
                                 GameObject o)
return p in the worldspace of o


farther

public static boolean farther(GameObject ball,
                              GameObject canidate)
Given too game objects, ball and canidate, father will return true only if ball is getting closer to canidate.

Requires:
ball and canidate != null
Returns:
true iff ball is moving towards canidate