Hitbox<T extends Hitbox<T>> class abstract

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.

Implemented types
Implementers

Constructors

Hitbox()

Properties

aabb Aabb2
The axis-aligned bounding box of the Hitbox, this is used to make a rough estimation of whether two hitboxes can possibly collide or not.
no setter
activeCollisions Set<T>
The objects that the object is currently colliding with.
no setterinherited
collisionType CollisionType
Whether the hitbox should:
no setter
hashCode int
The hash code for this object.
no setterinherited
isColliding bool
Whether the object is currently colliding or not.
no setterinherited
isSolid bool
Whether the hitbox is solid or hollow.
no setter
onCollisionCallback CollisionCallback<T>?
Assign your own CollisionCallback if you want a callback when this shape collides with another T.
getter/setter pairinherited
onCollisionEndCallback CollisionEndCallback<T>?
Assign your own CollisionEndCallback if you want a callback when this shape stops colliding with another T.
getter/setter pairinherited
onCollisionStartCallback CollisionCallback<T>?
Assign your own CollisionCallback if you want a callback when this shape starts to collide with another T.
getter/setter pairinherited
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.
inherited
containsPoint(Vector2 point) bool
Checks whether the Hitbox contains the point.
intersections(T other) Set<Vector2>
Where this Hitbox has intersection points with another Hitbox.
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.
inherited
onCollisionEnd(T other) → void
onCollisionEnd is called once when this object has stopped colliding with other.
inherited
onCollisionStart(Set<Vector2> intersectionPoints, T other) → void
onCollisionStart is called in the first tick when this object starts colliding with other.
inherited
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.
inherited
possiblyIntersects(T other) bool
This should be a cheaper calculation than comparing the exact boundaries if the exact calculation is expensive. This method could for example check two Rects or Aabb2s against each other.
toString() String
A string representation of this object.
inherited

Operators

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