Skip to main content

AABB

TypeNameInterface Description
VariablesmaxX: number

Function: The maximum X coordinate of the bounding box.

VariablesmaxY: number

Function: The maximum Y coordinate of the bounding box.

VariablesmaxZ: number

Function: The maximum Z coordinate of the bounding box.

VariablesminX: number

Function: The minimum X coordinate of the bounding box.

VariablesminY: number

Function: The minimum Y coordinate of the bounding box.

VariablesminZ: number

Function: The minimum Z coordinate of the bounding box.

Example

      console.log('minX', this.aabb.minX);
console.log('minY', this.aabb.minY);
console.log('minZ', this.aabb.minZ);
console.log('maxX', this.aabb.maxX);
console.log('maxY', this.aabb.maxY);
console.log('maxZ', this.aabb.maxZ);
TypeNameInterface Description
Functionsconstructor()

Function: Creates a default bounding box instance with both the minimum and maximum values initialized to 0.

Functionsconstructor(min: Vector3f, max: Vector3f)

Function: Create an instance of a bounding box with specified minimum and maximum values.

Examples

constructor()

let aabb = new AABB();

constructor(min: Vector3f, max: Vector3f)

let min = new Vector3f(0, 0, 0);
let max = new Vector3f(10, 10, 10);
let aabb = new AABB(min, max);

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
private firstFrame = true;
private time = 0.0;
private aabb: APJS.AABB = new APJS.AABB(new APJS.Vector3f(-1,-1,-1), new APJS.Vector3f(1,1,1));
onStart() {
}
onUpdate(deltaTime: number) {
if (this.firstFrame) {
this.firstFrame = false;

console.log('minX', this.aabb.minX);
console.log('minY', this.aabb.minY);
console.log('minZ', this.aabb.minZ);
console.log('maxX', this.aabb.maxX);
console.log('maxY', this.aabb.maxY);
console.log('maxZ', this.aabb.maxZ);

}

}
}

DemoAABBConstruction.zip

TypeNameInterface Description
Functionsequals(v: AABB): boolean

Function: Checks whether the current bounding box is equal to another bounding box.

FunctionstoString(): string

Function: Returns the string representation of the bounding box for easy debugging and logging.

Functionsintersects(other: AABB): boolean

Function: Check if the current bounding box intersects with another bounding box.

Functionsclone(): AABB

Function: Clone

Examples

equals(v: AABB): boolean

let aabb1 = new AABB(new Vector3f(0, 0, 0), new Vector3f(10, 10, 10));
let aabb2 = new AABB(new Vector3f(0, 0, 0), new Vector3f(10, 10, 10));
let isEqual = aabb1.equals(aabb2); // true

toString(): string

let aabb = new AABB(new Vector3f(0, 0, 0), new Vector3f(10, 10, 10));
console.log(aabb.toString()); // "AABB(min: (0, 0, 0), max: (10, 10, 10))"

toString(): string

let aabb = new AABB(new Vector3f(0, 0, 0), new Vector3f(10, 10, 10));
console.log(aabb.toString()); // "AABB(min: (0, 0, 0), max: (10, 10, 10))"

intersects(other: AABB): boolean

let aabb1 = new AABB(new Vector3f(0, 0, 0), new Vector3f(10, 10, 10));
let aabb2 = new AABB(new Vector3f(5, 5, 5), new Vector3f(15, 15, 15));
let doesIntersect = aabb1.intersects(aabb2); // true

clone(): AABB

let aabb1 = new AABB(new Vector3f(0, 0, 0), new Vector3f(10, 10, 10));
let aabbCloned = aabb1.clone();

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
private firstFrame = true;
private time = 0.0;
onStart() {
}
onUpdate(deltaTime: number) {
if (this.firstFrame) {
this.firstFrame = false;

let aabb1 = new APJS.AABB(new APJS.Vector3f(0, 0, 0), new APJS.Vector3f(10, 10, 10));
let aabb2 = new APJS.AABB(new APJS.Vector3f(0, 0, 0), new APJS.Vector3f(10, 10, 10));
let isEqual = aabb1.equals(aabb2); // true
let isIntersect = aabb1.intersects(aabb2); // true
let aabbCloned = aabb1.clone();
console.log(isEqual, isIntersect, aabbCloned.toString());

}

}
}

DemoAABBAPI.zip

Copyright © 2025 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalCookies