Broadphase<T extends Hitbox<T>> class abstract

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.

Currently there are two implementations of Broadphase:

  • Sweep is the simplest system. It simply short-circuits potential collisions based on the horizontal (x) position of the components in question. It is the default implementation when you use HasCollisionDetection.
  • QuadTree works faster in some cases. It requires additional setup and works only with fixed-size maps. See HasQuadTreeCollisionDetection for details.

Always experiment to see which approach works best for your game.

Implementers

Constructors

Broadphase()

Properties

hashCode int
The hash code for this object.
no setterinherited
items List<T>
Returns a flat List of items regardless of what data structure is used to store collision information.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(T item) → void
Adds an item to the broadphase. Should be called in a CollisionDetection class while adding a hitbox into its collision detection system.
addAll(Iterable<T> items) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query() Iterable<CollisionProspect<T>>
Returns the potential hitbox collisions
remove(T item) → void
Removes an item from the broadphase. Should be called in a CollisionDetection class while removing a hitbox from its collision detection system.
removeAll(Iterable<T> items) → void
toString() String
A string representation of this object.
inherited
update() → void
This method can be used if there are things that needs to be prepared in each tick.

Operators

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