public final class CollisionResult extends Object implements Poolable
hasCollided()
will return true
if a collision has occurred, false otherwise.Modifier and Type | Field and Description |
---|---|
static CollisionResult |
COLLISION
Constant for reporting collision.
|
static CollisionResult |
NO_COLLISION
Constant for reporting no collision.
|
Constructor and Description |
---|
CollisionResult() |
Modifier and Type | Method and Description |
---|---|
HitBox |
getBoxA() |
HitBox |
getBoxB() |
boolean |
hasCollided() |
void |
init(HitBox boxA,
HitBox boxB)
Init CollisionResult with positive result, i.e.
|
void |
reset()
Resets the object for reuse.
|
public static final CollisionResult NO_COLLISION
getBoxA()
and getBoxB()
return null and hasCollided()
returns false.public static final CollisionResult COLLISION
getBoxA()
and getBoxB()
return null and hasCollided()
returns true.public void init(HitBox boxA, HitBox boxB)
hasCollided()
returns true.boxA
- hit box of first entityboxB
- hit box of second entitypublic HitBox getBoxA()
public HitBox getBoxB()
public boolean hasCollided()
Copyright © 2018. All rights reserved.