AxisAlignedBoundingBox

class AxisAlignedBoundingBox(min: Vec2, max: Vec2)

Axis aligned bounding box volume class. Allows the creation of bounding volumes to make broad phase collision check possible and easy to do.

Constructor to generate an AABB given a minimum and maximum bound in the form of two vectors.

Parameters

min

Lower bound of AABB vertex.

max

Higher bound of AABB vertex.

Constructors

Link copied to clipboard
fun AxisAlignedBoundingBox(min: Vec2 = Vec2(), max: Vec2 = Vec2())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun aabbOverlap(point: Vec2): Boolean

Method to check if a point resides inside an AABB in object space.

Link copied to clipboard
fun addOffset(offset: Vec2)

Method to add offset to the AABB's bounds. Can be useful to convert from object to world space .

Link copied to clipboard
fun copy(): AxisAlignedBoundingBox

Copy method to return a new AABB that's the same as the current object.

Link copied to clipboard
fun set(aabb: AxisAlignedBoundingBox)

Sets the current objects bounds equal to that of the passed AABB argument.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val isValid: Boolean

Method to check if an AABB is valid. Makes sure the bounding volume is not; a point, has order of vertex's backwards and valid values have been used for the bounds.

Link copied to clipboard
var max: Vec2

Top right vertex of bounding box.

Link copied to clipboard
var min: Vec2

Lower left vertex of bounding box.