|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.starhope.appius.physica.CollisionObject
public final class CollisionObject
A generic collision object. Used primarily for 'rewinding' objects when they collide so that the true point of collision can be found
| Field Summary | |
|---|---|
private Coord2D |
centerofMass
Object's center of mass |
private boolean |
changed
Determines if this object has changed since the last reset |
private PolygonPrimitive<?> |
collisionBounds
Object's collision boundaries |
private double |
mass
Object's mass |
private long |
moveEndTime
The time the object will stop moving |
private long |
moveStartTime
The time the object started moving |
private long |
referenceTime
The current time index for this snapshot |
private Vector2D |
velocity
Object's velocity |
| Constructor Summary | |
|---|---|
CollisionObject(Collidable obj,
long currentTime)
WRITEME: Document this constructor |
|
| Method Summary | |
|---|---|
boolean |
changed()
Gets the current moved status |
Coord2D |
getCenterOfMass()
Gets the object's current center of mass in world coordinates |
PolygonPrimitive<?> |
getCollisionBounds()
Gets the collision boundaries for the object |
long |
getEndMovementTime(long currentTime)
|
double |
getMass()
Gets the mass of the collidable object |
long |
getStartMovementTime()
|
Vector2D |
getVelocity()
Gets the object's current velocity |
void |
move(long milliseconds)
Moves the object forward/backwards by x milliseconds Also watches for objects that start/stop |
void |
reset()
Resets the moved flag |
void |
setCenterOfMass(Coord2D com)
Sets the center of mass |
void |
setVelocity(Vector2D newVelocity)
Sets the object's new velocity |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Coord2D centerofMass
private PolygonPrimitive<?> collisionBounds
private final double mass
private final long moveStartTime
private final long moveEndTime
private long referenceTime
private Vector2D velocity
private boolean changed
| Constructor Detail |
|---|
public CollisionObject(Collidable obj,
long currentTime)
obj - WRITEMEcurrentTime - WRITEME| Method Detail |
|---|
public boolean changed()
public Coord2D getCenterOfMass()
Collidable
getCenterOfMass in interface CollidableCollidable.getCenterOfMass()public PolygonPrimitive<?> getCollisionBounds()
Collidable
getCollisionBounds in interface CollidableCollidable.getCollisionBounds()public long getEndMovementTime(long currentTime)
getEndMovementTime in interface CollidablecurrentTime - The current time
Collidable.getEndMovementTime(long)public double getMass()
Collidable
getMass in interface CollidableCollidable.getMass()public long getStartMovementTime()
getStartMovementTime in interface CollidableCollidable.getStartMovementTime()public Vector2D getVelocity()
Collidable
getVelocity in interface CollidableCollidable.getVelocity()public void move(long milliseconds)
milliseconds - WRITEMEpublic void reset()
public void setCenterOfMass(Coord2D com)
setCenterOfMass in interface Collidablecom - New center of mass in world coordinatesCollidable.setCenterOfMass(Coord2D)public void setVelocity(Vector2D newVelocity)
Collidable
setVelocity in interface CollidablenewVelocity - WRITEMECollidable.setVelocity(Vector2D)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||