Class BoxCollider
java.lang.Object
org.collebol.shared.physics.PhysicsComponent
org.collebol.shared.physics.collision.Collider
org.collebol.shared.physics.collision.BoxCollider
A rectangular collider used for detecting collisions between box-shaped
GameObject instances. This collider uses axis-aligned bounding box (AABB)
intersection logic to determine overlaps with other BoxCollider instances.
Usage:
MyGameObject gameObj = new MyGameObject();
gameObj.addPhysicsComponent(new BoxCollider(gameObj, 1, 1));
You can also use GameManager to register and move Entity's:
MyEntity entity = new MyEntity();
entity.addPhysicsComponent(new BoxCollider(entity, 1, 1));
gameManager.getGameRegister().registerEntity(entity);
// update to new location.
gameManager.getGameRegister().getPhysicsManager().tryMove(entity, newLoc);
- Since:
- 1.0-dev
- Author:
- ColleBol - contact@collebol.org
-
Field Summary
Fields inherited from class org.collebol.shared.physics.PhysicsComponent
owner -
Constructor Summary
ConstructorsConstructorDescriptionBoxCollider(GameObject owner, GameLocation originLocation, double width, double height) Constructs a newBoxColliderfor the given game object with the specified width and height. -
Method Summary
Methods inherited from class org.collebol.shared.physics.collision.Collider
getLocation, getOriginLocation
-
Constructor Details
-
Method Details
-
getWidth
public double getWidth() -
setWidth
public void setWidth(double width) -
getHeight
public double getHeight() -
setHeight
public void setHeight(double height)