Class: AABB

Colliders.AABB

Axis-Aligned Bounding Box

new Colliders.AABB (_x, _y, _width, _height)

Name Type Description
_x Number x position of the AABB
_y Number y position of the AABB
_width Number width position of the AABB
_height Number height position of the AABB

Methods

containsPoint (x, y)Boolean

checks whether AABB contains a point.
Name Type Description
x Number the x position of the point to test.
y Number the y position of the point to test.
Returns:
Type Description
Boolean true if it contains the point, false otherwise.

getNormal (other)Utils.Vector2d

calculates normal vector with other AABB. Assumes penetration.
Name Type Description
other Colliders.AABB other AABB to calculate normal with.
Returns:
Type Description
Utils.Vector2d the normal vector.

getPenetration (other)Utils.Vector2d

calculates penetration vector with other AABB. Assumes penetration itself.
Name Type Description
other Colliders.AABB other AABB to calculate penetration with.
Returns:
Type Description
Utils.Vector2d the penetration vector.

isColliding (other)Boolean

checks AABB collision with other AABB.
Name Type Description
other Colliders.AABB other AABB to check collision against.
Returns:
Type Description
Boolean true if they collide, false otherwise.

reset ()

re-sets the AABB (updates min max axis points)

setTransform (transform)

set the AABB position from a transform.
Name Type Description
transform Core.Transform the transform to get position from