GenericCollisionCallbacks<T> mixin

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.

Mixin applications

Properties

activeCollisions Set<T>
The objects that the object is currently colliding with.
no setter
hashCode int
The hash code for this object.
no setterinherited
isColliding bool
Whether the object is currently colliding or not.
no setter
onCollisionCallback CollisionCallback<T>?
Assign your own CollisionCallback if you want a callback when this shape collides with another T.
getter/setter pair
onCollisionEndCallback CollisionEndCallback<T>?
Assign your own CollisionEndCallback if you want a callback when this shape stops colliding with another T.
getter/setter pair
onCollisionStartCallback CollisionCallback<T>?
Assign your own CollisionCallback if you want a callback when this shape starts to collide with another T.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

collidingWith(T other) bool
Whether the object is colliding with other or not.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCollision(Set<Vector2> intersectionPoints, T other) → void
onCollision is called in every tick when this object is colliding with other.
onCollisionEnd(T other) → void
onCollisionEnd is called once when this object has stopped colliding with other.
onCollisionStart(Set<Vector2> intersectionPoints, T other) → void
onCollisionStart is called in the first tick when this object starts colliding with other.
onComponentTypeCheck(PositionComponent other) bool
Works only for the QuadTree collision detection. If you need to prevent collision of items of different types - reimplement onComponentTypeCheck. The result of calculation is cached so you should not check any dynamical parameters here, the function intended to be used as pure type checker. Call super.onComponentTypeCheck to get the parent's result of the type check if needed. In other causes this call is redundant in game code.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited