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>, B extends Broadphase<T>>
CollisionDetection is the foundation of the collision detection system in Flame.
CollisionDetectionCompletionNotifier
A class to handle callbacks for when the collision detection is done each tick.
CollisionProspect<T>
A CollisionProspect is a tuple that is used to contain two potentially colliding hitboxes.
CollisionTypeNotifier
Utility class allows to subscribe on collision type changing event
CompositeHitbox
In this PositionComponent hitboxes can be added to emulate a hitbox that is a composition of other 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.
ProspectPool<T extends Hitbox<T>>
This pool is used to not create unnecessary CollisionProspect objects during collision detection, but to re-use the ones that have already been created.
QuadTree<T extends Hitbox<T>>
QuadTree calculation class not bound to Flame. Could be used anywhere outside of Flame, for example in isolates to calculate background logic.
QuadTreeBroadphase
Performs Quad Tree broadphase check.
QuadTreeCollisionDetection
Collision detection modification to support a Quad Tree broadphase.
QuadTreeNode<T extends Hitbox<T>>
QuadTreeNodeDebugInfo
Public interface to QuadTree internal data structures.
RaycastResult<T extends Hitbox<T>>
The result of a raycasting operation.
RectangleHitbox
A Hitbox in the shape of a rectangle (a simplified polygon).
ScreenHitbox<T extends FlameGame<World>>
This component is used to detect hitboxes colliding into the edges of the viewport of the game.
StandardCollisionDetection<B extends Broadphase<ShapeHitbox>>
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.
HasQuadTreeCollisionDetection<W extends World>
This should be applied to a FlameGame to bring QuadTree collision support.
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.
ExternalBroadphaseCheck = bool Function(ShapeHitbox first, ShapeHitbox second)
ExternalMinDistanceCheck = bool Function(Vector2 activeItemCenter, Vector2 potentialCenter)