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()

Methods

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.

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):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.

polygonContainsPoint(polygon:FloatArray, x:Float, y:Float):Bool

Returns true if the polygon contains the point.

intersectsSegment(x1:Float, y1:Float, x2:Float, y2:Float):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(float, float, float, float)} returns true.

polygonIntersectsSegment(polygon:FloatArray, x1:Float, y1:Float, x2:Float, y2:Float):Bool

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

getMinX():Float

The left edge of the axis aligned bounding box.

getMinY():Float

The bottom edge of the axis aligned bounding box.

getMaxX():Float

The right edge of the axis aligned bounding box.

getMaxY():Float

The top edge of the axis aligned bounding box.

getWidth():Float

The width of the axis aligned bounding box.

getHeight():Float

The height of the axis aligned bounding box.

getBoundingBoxes():Array<BoundingBoxAttachment>

The visible bounding boxes.

getPolygons():FloatArray2D

The world vertices for the bounding box polygons.

getPolygon(boundingBox:BoundingBoxAttachment):FloatArray

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