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
Variables
boundingBoxes:Array<BoundingBoxAttachment> = new Array<BoundingBoxAttachment>()
The visible bounding boxes.
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.
getPolygon(boundingBox:BoundingBoxAttachment):Null<Array<Float>>
Returns the polygon for the specified bounding box, or null.
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. |
---|