StandardCollisionDetection class

The default implementation of CollisionDetection. Checks whether any ShapeHitboxs in items collide with each other and calls their callback methods accordingly.

By default the Sweep broadphase is used, this can be configured by passing in another Broadphase to the constructor.

Inheritance

Properties

broadphase Broadphase<ShapeHitbox>
finalinherited
hashCode int
The hash code for this object.
no setterinherited
items List<ShapeHitbox>
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(ShapeHitbox item) → void
inherited
addAll(Iterable<ShapeHitbox> items) → void
inherited
handleCollision(Set<Vector2> intersectionPoints, ShapeHitbox hitboxA, ShapeHitbox hitboxB) → void
Calls the two colliding hitboxes every tick when they are colliding. They are called with the intersectionPoints and instances of each other, so that they can determine what hitbox (and what ShapeHitbox.hitboxParent that they have collided with.
override
handleCollisionEnd(ShapeHitbox hitboxA, ShapeHitbox hitboxB) → void
Calls the two colliding hitboxes once when two hitboxes have stopped colliding. They are called with instances of each other, so that they can determine what hitbox (and what ShapeHitbox.hitboxParent that they have stopped colliding with.
override
handleCollisionStart(Set<Vector2> intersectionPoints, ShapeHitbox hitboxA, ShapeHitbox hitboxB) → void
Calls the two colliding hitboxes when they first starts to collide. They are called with the intersectionPoints and instances of each other, so that they can determine what hitbox (and what ShapeHitbox.hitboxParent that they have collided with.
override
intersections(ShapeHitbox hitboxA, ShapeHitbox hitboxB) Set<Vector2>
Check what the intersection points of two collidables are, returns an empty list if there are no intersections.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(ShapeHitbox item) → void
Removes the item from the collision detection, if you just want to temporarily inactivate it you can set collisionType = CollisionType.inactive; instead.
inherited
removeAll(Iterable<ShapeHitbox> items) → void
Removes all items from the collision detection, see remove.
inherited
run() → void
Run collision detection for the current state of items.
inherited
toString() String
A string representation of this object.
inherited

Operators

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