public final class PhysicsEngine extends java.lang.Object implements IPhysicsEngine
| Constructor and Description |
|---|
PhysicsEngine()
Instantiates a new physics engine.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ICollisionEntity entity) |
void |
add(java.awt.geom.Rectangle2D staticCollisionBox) |
void |
clear() |
boolean |
collides(double x,
double y) |
boolean |
collides(double x,
double y,
CollisionType collisionType) |
boolean |
collides(double x,
double y,
ICollisionEntity collisionEntity) |
java.awt.geom.Point2D |
collides(java.awt.geom.Line2D rayCast) |
java.awt.geom.Point2D |
collides(java.awt.geom.Line2D rayCast,
CollisionType collisionType) |
boolean |
collides(java.awt.geom.Point2D point) |
boolean |
collides(java.awt.geom.Point2D point,
CollisionType collisionType) |
boolean |
collides(java.awt.geom.Point2D point,
ICollisionEntity collisionEntity) |
boolean |
collides(java.awt.geom.Rectangle2D rect) |
boolean |
collides(java.awt.geom.Rectangle2D rect,
CollisionType collisionType)
Checks whether the specified rectangle collides with anything.
|
java.util.List<ICollisionEntity> |
collidesWithEntities(java.awt.geom.Rectangle2D rect) |
java.util.List<java.awt.geom.Rectangle2D> |
getAllCollisionBoxes() |
java.awt.geom.Rectangle2D |
getBounds() |
java.util.List<ICollisionEntity> |
getCollisionEntities() |
java.util.List<java.awt.geom.Rectangle2D> |
getStaticCollisionBoxes() |
boolean |
move(IMobileEntity entity,
double angle,
double delta)
Moves the specified entity by the delta in the direction of the angle.
|
boolean |
move(IMobileEntity entity,
double x,
double y,
float delta) |
boolean |
move(IMobileEntity entity,
float delta) |
boolean |
move(IMobileEntity entity,
java.awt.geom.Point2D newPosition) |
boolean |
move(IMobileEntity entity,
java.awt.geom.Point2D target,
float delta) |
void |
remove(ICollisionEntity entity) |
void |
remove(java.awt.geom.Rectangle2D staticCollisionBox) |
void |
setBounds(java.awt.geom.Rectangle2D environmentBounds) |
void |
update()
This method is called by the game loop on all objects that need to update
their attributes.
|
public void add(ICollisionEntity entity)
add in interface IPhysicsEnginepublic void add(java.awt.geom.Rectangle2D staticCollisionBox)
add in interface IPhysicsEnginepublic void clear()
clear in interface IPhysicsEnginepublic boolean collides(double x,
double y)
collides in interface IPhysicsEnginepublic boolean collides(double x,
double y,
CollisionType collisionType)
collides in interface IPhysicsEnginepublic boolean collides(double x,
double y,
ICollisionEntity collisionEntity)
collides in interface IPhysicsEnginepublic boolean collides(java.awt.geom.Point2D point,
ICollisionEntity collisionEntity)
collides in interface IPhysicsEnginepublic boolean collides(java.awt.geom.Point2D point,
CollisionType collisionType)
collides in interface IPhysicsEnginepublic java.awt.geom.Point2D collides(java.awt.geom.Line2D rayCast,
CollisionType collisionType)
collides in interface IPhysicsEnginepublic java.awt.geom.Point2D collides(java.awt.geom.Line2D rayCast)
collides in interface IPhysicsEnginepublic boolean collides(java.awt.geom.Point2D point)
collides in interface IPhysicsEnginepublic boolean collides(java.awt.geom.Rectangle2D rect)
collides in interface IPhysicsEnginepublic boolean collides(java.awt.geom.Rectangle2D rect,
CollisionType collisionType)
IPhysicsEnginecollides in interface IPhysicsEnginerect - The rectangle to check the collision for.collisionType - use the following flags
public java.util.List<ICollisionEntity> collidesWithEntities(java.awt.geom.Rectangle2D rect)
collidesWithEntities in interface IPhysicsEnginepublic java.util.List<java.awt.geom.Rectangle2D> getAllCollisionBoxes()
getAllCollisionBoxes in interface IPhysicsEnginepublic java.util.List<ICollisionEntity> getCollisionEntities()
getCollisionEntities in interface IPhysicsEnginepublic java.util.List<java.awt.geom.Rectangle2D> getStaticCollisionBoxes()
getStaticCollisionBoxes in interface IPhysicsEnginepublic java.awt.geom.Rectangle2D getBounds()
getBounds in interface IPhysicsEnginepublic boolean move(IMobileEntity entity, double angle, double delta)
IPhysicsEnginemove in interface IPhysicsEngineentity - the entityangle - the angledelta - the deltapublic boolean move(IMobileEntity entity, double x, double y, float delta)
move in interface IPhysicsEnginepublic boolean move(IMobileEntity entity, float delta)
move in interface IPhysicsEnginepublic boolean move(IMobileEntity entity, java.awt.geom.Point2D newPosition)
move in interface IPhysicsEnginepublic boolean move(IMobileEntity entity, java.awt.geom.Point2D target, float delta)
move in interface IPhysicsEnginepublic void remove(ICollisionEntity entity)
remove in interface IPhysicsEnginepublic void remove(java.awt.geom.Rectangle2D staticCollisionBox)
remove in interface IPhysicsEnginepublic void setBounds(java.awt.geom.Rectangle2D environmentBounds)
setBounds in interface IPhysicsEnginepublic void update()
IUpdateableupdate in interface IUpdateable