CollisionMesh

CollisionMesh

A CollisionMesh class.

Constructor

new CollisionMesh(boxes)

Parameters:
Name Type Description
boxes Array.<BoundingBox>

An array of objects thatg resolve to BoundingBox.

Methods

clone() → {CollisionMesh}

Clone the current collisionmesh to a new object.

Returns:
Type:
CollisionMesh

A clone of this instance

getBoundingBox() → {BoundingBox}

Returns a BoundingBox instance version of this collisionmesh, which encapsulates all of it's internal boxes.

Returns:
Type:
BoundingBox

getColliding(other) → {BoundingBox|undefined}

Returns which box of other that this intersects an area of, not an edge.

Parameters:
Name Type Description
other CollisionMesh | Array.<BoundingBox>
Returns:
Type:
BoundingBox | undefined

getCollisionMesh() → {CollisionMesh}

Resolve this object down to a CollisionMesh instance. Since this instance is already a collisionmesh, it returns itself.

Returns:
Type:
CollisionMesh

self

getHeight() → {Number}

Returns the height of this.

Returns:
Type:
Number

height

getPosition() → {Vector}

Returns the position of this.

Returns:
Type:
Vector

position

getSize() → {Vector}

Returns the size of this.

Returns:
Type:
Vector

size

getWidth() → {Number}

Returns the width of this.

Returns:
Type:
Number

width

isColliding(other) → {Boolean}

Determines if this intersects an area of other, not an edge.

Parameters:
Name Type Description
other CollisionMesh | Array.<BoundingBox>
Returns:
Type:
Boolean

isContains(other) → {Boolean}

Determines if this encapsulates all of other.

Parameters:
Name Type Description
other CollisionMesh | Array.<BoundingBox>
Returns:
Type:
Boolean

isTouching(other) → {Boolean}

Determines if this touches an edge of other, but does not intersect area.

Parameters:
Name Type Description
other CollisionMesh | Array.<BoundingBox>
Returns:
Type:
Boolean

moveBy(deltaLeftopt, deltaTopopt) → {BoundingBox}

Move this relatively to position by deltaLeft and/or deltaTop.

Parameters:
Name Type Attributes Default Description
deltaLeft Number <optional>
null
deltaTop Number <optional>
null
Returns:
Type:
BoundingBox

self

moveTo(leftopt, topopt) → {BoundingBox}

Move this to position at left and/or top.

Parameters:
Name Type Attributes Default Description
left Number <optional>
null
top Number <optional>
null
Returns:
Type:
BoundingBox

self

someColliding(others) → {Boolean}

Determines if this intersects an area of one of others, not an edge.

Parameters:
Name Type Description
others Array.<CollisionMesh>
Returns:
Type:
Boolean

someContains(other) → {Boolean}

Determines if this encapsulates at least one of other.

Parameters:
Name Type Description
other CollisionMesh | Array.<BoundingBox>
Returns:
Type:
Boolean

someTouching(others) → {Boolean}

Determines if this touches an edge of one of others, but does not intersect area.

Parameters:
Name Type Description
others Array.<CollisionMesh>
Returns:
Type:
Boolean