Collided
is a YaegerEntity
that can be collided with by a
Collider
. In such a case, the Collided
is the YaegerEntity
that
gets notified of the collision.
There are different types of collision detection. In the case of an Collided
we perform a so called
Axis-Aligned Bounding Box collision detection, which is based on the bounding box of the YaegerEntity
.
Each Game World Update a Collided
is checked against all instances ofCollider
. If many instances
of Collider
are part of the YaegerScene
, which could lead to many calculations, which could slow
down the game and framerate. So make sure only those instances of YaegerEntity
that really need to be part
of the collision detection to implement the Collided
or Collider
interfaces.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
checkForCollisions
(List<Collider> colliders) void
onCollision
(List<Collider> collidingObjects) This method is called if a collision has occurred.Methods inherited from interface com.github.hanyaeger.core.entities.Bounded
getBoundingBox, getHeight, getWidth
-
Method Details
-
onCollision
This method is called if a collision has occurred. -
checkForCollisions
Perform collision detection with aSet
ofCollider
instances. Only the first collision is detected.Note that all of this takes place during the same Game World update. The re-rendering takes place after this update completes, meaning the undoing will cause no jitter effect.
Note: This method is part of the internal API, and should not be used when implementing a Yaeger game.
- Parameters:
colliders
- aSet
of colliders that should be checked for collisions
-