Skip to main content

Class: MapColliderUtils

Defined in: src/sdk/components/map/colliders/MapColliderUtils.ts:9

A utility class for working with map colliders.

Constructors​

Constructor​

new MapColliderUtils(): MapColliderUtils

Returns​

MapColliderUtils

Methods​

aabb2Intersection()​

static aabb2Intersection(b1x1, b1y1, b1x2, b1y2, b2x1, b2y1, b2x2, b2y2): boolean

Defined in: src/sdk/components/map/colliders/MapColliderUtils.ts:55

Tests whether two axis-aligned bounding boxes (AABB) intersect. AABBs are rectangles whose horizontal and vertical axes are aligned with the x and y axes, respectively.

Parameters​

ParameterTypeDescription
b1x1numberThe x coordinate of the first box's minimum-x edge.
b1y1numberThe y coordinate of the first box's minimum-y edge.
b1x2numberThe x coordinate of the first box's maximum-x edge.
b1y2numberThe y coordinate of the first box's maximum-y edge.
b2x1numberThe x coordinate of the second box's minimum-x edge.
b2y1numberThe y coordinate of the second box's minimum-y edge.
b2x2numberThe x coordinate of the second box's maximum-x edge.
b2y2numberThe y coordinate of the second box's maximum-y edge.

Returns​

boolean

Whether the two axis-aligned bounding boxes (AABB) intersect.


aabbCircleIntersection()​

static aabbCircleIntersection(bx1, by1, bx2, by2, cx, cy, cRadius): boolean

Defined in: src/sdk/components/map/colliders/MapColliderUtils.ts:70

Tests whether an axis-aligned bounding box (AABB) intersects a circle.

Parameters​

ParameterTypeDescription
bx1numberThe x coordinate of the box's minimum-x edge.
by1numberThe y coordinate of the box's minimum-y edge.
bx2numberThe x coordinate of the box's maximum-x edge.
by2numberThe y coordinate of the box's maximum-y edge.
cxnumberThe x coordinate of the center of the circle.
cynumberThe y coordinate of the center of the circle.
cRadiusnumberThe radius of the circle.

Returns​

boolean

Whether the specified axis-aligned bounding box (AABB) and circle intersect.


circle2Intersection()​

static circle2Intersection(c1x, c1y, c1Radius, c2x, c2y, c2Radius): boolean

Defined in: src/sdk/components/map/colliders/MapColliderUtils.ts:38

Tests whether two circles intersect.

Parameters​

ParameterTypeDescription
c1xnumberThe x coordinate of the center of the first circle.
c1ynumberThe y coordinate of the center of the first circle.
c1RadiusnumberThe radius of the first circle.
c2xnumberThe x coordinate of the center of the second circle.
c2ynumberThe x coordinate of the center of the second circle.
c2RadiusnumberThe radius of the second circle.

Returns​

boolean

Whether the two specified circles intersect.


isCollider()​

static isCollider(query): query is MapCollider

Defined in: src/sdk/components/map/colliders/MapColliderUtils.ts:15

Checks whether a query value is a MapCollider.

Parameters​

ParameterTypeDescription
queryunknownThe query value to check.

Returns​

query is MapCollider

Whether the specified query value is a MapCollider.


isIndexedCollider()​

static isIndexedCollider(query): query is MapIndexedCollider

Defined in: src/sdk/components/map/colliders/MapColliderUtils.ts:24

Checks whether a query value is a MapIndexedCollider.

Parameters​

ParameterTypeDescription
queryunknownThe query value to check.

Returns​

query is MapIndexedCollider

Whether the specified query value is a MapCollider.


obb2Intersection()​

static obb2Intersection(b1x, b1y, b1AxisX, b1AxisY, b1HalfWidth, b1HalfHeight, b2x, b2y, b2AxisX, b2AxisY, b2HalfWidth, b2HalfHeight): boolean

Defined in: src/sdk/components/map/colliders/MapColliderUtils.ts:125

Tests whether two oriented bounding boxes (OBB) intersect. OBBs are rectangles whose horizontal and vertical axes have arbitrary orientations relative to the x and y axes.

Parameters​

ParameterTypeDescription
b1xnumberThe x coordinate of the center of the first box.
b1ynumberThe y coordinate of the center of the first box.
b1AxisXnumberThe x component of the unit vector parallel to the axis that defines the first box's width.
b1AxisYnumberThe y component of the unit vector parallel to the axis that defines the first box's width.
b1HalfWidthnumberThe half width of the first box.
b1HalfHeightnumberThe half height of the first box.
b2xnumberThe x coordinate of the center of the second box.
b2ynumberThe y coordinate of the center of the second box.
b2AxisXnumberThe x component of the unit vector parallel to the axis that defines the second box's width.
b2AxisYnumberThe y component of the unit vector parallel to the axis that defines the second box's width.
b2HalfWidthnumberThe half width of the second box.
b2HalfHeightnumberThe half height of the second box.

Returns​

boolean

Whether the two oriented bounding boxes (OBB) intersect.


obbCircleIntersection()​

static obbCircleIntersection(bx, by, bAxisX, bAxisY, bHalfWidth, bHalfHeight, cx, cy, cRadius): boolean

Defined in: src/sdk/components/map/colliders/MapColliderUtils.ts:212

Tests whether an oriented bounding box (OBB) intersects a circle.

Parameters​

ParameterTypeDescription
bxnumberThe x coordinate of the center of the box.
bynumberThe y coordinate of the center of the box.
bAxisXnumberThe x component of the unit vector parallel to the axis that defines the box's width.
bAxisYnumberThe y component of the unit vector parallel to the axis that defines the box's width.
bHalfWidthnumberThe half width of the box.
bHalfHeightnumberThe half height of the box.
cxnumberThe x coordinate of the center of the circle.
cynumberThe y coordinate of the center of the circle.
cRadiusnumberThe radius of the circle.

Returns​

boolean

Whether the specified oriented bounding box (OBB) and circle intersect.