collisions library

Classes

Broadphase<T extends Hitbox<T>>
The Broadphase class is used to make collision detection more efficient by doing a rough estimation of which hitboxes that can collide before their actual intersections are calculated.
CircleHitbox
A Hitbox in the shape of a circle.
CollisionDetection<T extends Hitbox<T>>
CollisionDetection is the foundation of the collision detection system in Flame.
CollisionProspect<T>
A CollisionProspect is a tuple that is used to contain two potentially colliding hitboxes.
Hitbox<T extends Hitbox<T>>
The Hitbox is the default building block to determine whether two objects have collided with each other. ShapeHitbox is the default implementation used in FCS.
PolygonHitbox
A Hitbox in the shape of a polygon.
RectangleHitbox
A Hitbox in the shape of a rectangle (a simplified polygon).
ScreenHitbox<T extends FlameGame>
This component is used to detect hitboxes colliding into the edges of the viewport of the game.
StandardCollisionDetection
The default implementation of CollisionDetection. Checks whether any ShapeHitboxs in items collide with each other and calls their callback methods accordingly.
Sweep<T extends Hitbox<T>>

Enums

CollisionType
The CollisionType is used to determine which other hitboxes that it should collide with.

Mixins

CollisionCallbacks
CollisionPassthrough
This mixin can be used if you want to pass the CollisionCallbacks to the next ancestor that can receive them. It can be used to group hitboxes together on a component, that then is added to another component that also cares about the collision events of the hitboxes.
GenericCollisionCallbacks<T>
The GenericCollisionCallbacks mixin can be used to get callbacks from the collision detection system, potentially without using the Flame component system. The default implementation used with FCS is CollisionCallbacks. The generic type T here is the type of the object that has the hitboxes are attached to, for example it is PositionComponent in the StandardCollisionDetection.
ShapeHitbox
A ShapeHitbox turns a ShapeComponent into a Hitbox. It is currently used by CircleHitbox, RectangleHitbox and PolygonHitbox.

Typedefs

CollisionCallback<T> = void Function(Set<Vector2> intersectionPoints, T other)
Can be used used to implement an onCollisionCallback or an onCollisionStartCallback.
CollisionEndCallback<T> = void Function(T other)
Can be used used to implement an onCollisionEndCallback.