SAPBroadphase class

Sweep and prune broadphase along one axis.

Inheritance

Constructors

SAPBroadphase(World? world)

Properties

axisIndex AxisIndex
Axis to sort the bodies along. Set to 0 for x axis, and 1 for y axis. For best performance, pick the axis where bodies are most distributed.
getter/setter pair
axisList List<Body>
List of bodies currently in the broadphase.
getter/setter pair
bscDist Vec3
finalinherited
dirty bool
Set to true if the objects in the world moved.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useBoundingBoxes bool
If set to true, the broadphase uses bounding boxes for intersection tests, else it uses bounding spheres.
getter/setter pairinherited
world World?
The world to search for collisions in.
getter/setter pairinherited

Methods

aabbQuery(World world, AABB aabb, [List<Body>? result]) List<Body>
Returns all the bodies within an AABB. @param result An array to store resulting bodies in.
override
autoDetectAxis() → void
Computes the variance of the body positions and estimates the best axis to use. Will automatically set property axisIndex.
boundingSphereCheck(Body bodyA, Body bodyB) bool
Check if the bounding spheres of two bodies overlap.
inherited
collisionPairs(World world, List<Body> p1, List<Body> p2) → void
Collect all collision pairs
override
doBoundingBoxBroadphase(Body bodyA, Body bodyB, List<Body> pairs1, List<Body> pairs2) → void
Check if the bounding boxes of two bodies are intersecting.
inherited
doBoundingSphereBroadphase(Body bodyA, Body bodyB, List<Body> pairs1, List<Body> pairs2) → void
Check if the bounding spheres of two bodies are intersecting. pairs1 bodyA is appended to this array if intersection pairs2 bodyB is appended to this array if intersection
inherited
intersectionTest(Body bodyA, Body bodyB, List<Body> pairs1, List<Body> pairs2) → void
Check if the bounding volumes of two bodies intersect.
inherited
makePairsUnique(List<Body> pairs1, List<Body> pairs2) → void
Removes duplicate pairs from the pair arrays.
inherited
needBroadphaseCollision(Body bodyA, Body bodyB) bool
Check if a body pair needs to be intersection tested at all.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setWorld(World world) → void
Change the world
override
sortList() → void
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

checkBounds(Body bi, Body bj, AxisIndex axisIndex) bool
Check if the bounds of two bodies overlap, along the given SAP axis.
insertionSortX(List<Body> a) List<Body>
insertionSortX
insertionSortY(List<Body> a) List<Body>
insertionSortY
insertionSortZ(List<Body> a) List<Body>
insertionSortZ