PolyBoundingScript

PolyBoundingScript

Checks for collisions against a set of collidables and repositions the host object accordingly.
This script uses the PolyK library which is not part of the engine; make sure you add it manually.

Constructor

new PolyBoundingScript(collidables)

Parameters:
Name Type Description
collidables Array.<Collidable>

An array of @{link Collidable} objects.

Methods

addCollidable(collidable)

Adds a collidable

Parameters:
Name Type Description
collidable Collidable

@{link Collidable} to add

inside(x, y, z)

Checks if a point is inside any collidable

Parameters:
Name Type Description
x number
y number
z number

removeAllAt(x, y, z)

Removes all collidables that contain the given point (x, y, z)

Parameters:
Name Type Description
x number
y number
z number

update(args, ctx)

Checks for collisions and repositions the host entity accordingly.
The entity's coordinates are obtained from the translation of its
transformComponent. All collisions are performed against these coordinates
only.

Parameters:
Name Type Description
args object
ctx object