Collects each visible {@link BoundingBoxAttachment} and computes the world vertices for its polygon. The polygon vertices are provided along with convenience methods for doing hit detection.

Constructor

new()

Variables

@:value(new Array<BoundingBoxAttachment>())boundingBoxes:Array<BoundingBoxAttachment> = new Array<BoundingBoxAttachment>()

The visible bounding boxes.

@:value(0.0)maxX:Float = 0.0

The right edge of the axis aligned bounding box.

@:value(0.0)maxY:Float = 0.0

The top edge of the axis aligned bounding box.

@:value(0.0)minX:Float = 0.0

The left edge of the axis aligned bounding box.

@:value(0.0)minY:Float = 0.0

The bottom edge of the axis aligned bounding box.

@:value(new Array<Array<Float>>())polygons:Array<Array<Float>> = new Array<Array<Float>>()

The world vertices for the bounding box polygons.

Methods

aabbContainsPoint(x:Float, y:Float):Bool

Returns true if the axis aligned bounding box contains the point.

aabbIntersectsSegment(x1:Float, y1:Float, x2:Float, y2:Float):Bool

Returns true if the axis aligned bounding box intersects the line segment.

aabbIntersectsSkeleton(bounds:SkeletonBounds):Bool

Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds.

containsPoint(x:Float, y:Float):Null<BoundingBoxAttachment>

Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true.

containsPointPolygon(polygon:Array<Float>, x:Float, y:Float):Bool

Returns true if the polygon contains the point.

getHeight():Float

The height of the axis aligned bounding box.

getPolygon(boundingBox:BoundingBoxAttachment):Null<Array<Float>>

Returns the polygon for the specified bounding box, or null.

getWidth():Float

The width of the axis aligned bounding box.

intersectsSegment(x1:Float, y1:Float, x2:Float, y2:Float):Null<BoundingBoxAttachment>

Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns true.

intersectsSegmentPolygon(polygon:Array<Float>, x1:Float, y1:Float, x2:Float, y2:Float):Bool

Returns true if the polygon contains any part of the line segment.

update(skeleton:Skeleton, updateAabb:Bool):Void

Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding box's polygon.

Parameters:

updateAabb

If true, the axis aligned bounding box containing all the polygons is computed. If false, the SkeletonBounds AABB methods will always return true.