Table Of Contents

Previous topic

std.graphics.InputBinding

Next topic

motion

This Page

coll

Constructor

class coll()

Methods

Bounce(elast)
Arguments:
  • elast (number) – The elasticity of collisions. For normal results, this should be a number between 0 and 1, inclusive.
Returns:

A collision response function that bounces the colliding object off the other object at an equal angle, multiplying its velocity by the given elasticity.

Return type:

function(presence|object)->undefined

Stop()
Returns:A collision response function that stops the colliding presence at the point of collision.
Return type:function(presence|object)->undefined
TestBounds(upper, lower)
Arguments:
  • upper (util.Vec3) – The position of the corner of the axis-aligned bounding box on the most positive side in all three axes
  • lower (util.Vec3) – The position of the corner on the most negative side in all three axes
Returns:

A collision test function that tests the colliding presence (passed to the Collision motion controller) against the sides of an axis-aligned bounding box defined by the two corners specified. Collision normals, etc. are reported as if the presence is spherical.

Return type:

function(presence)->object

TestSpheres(visibles)
Arguments:
  • visibles (Array<visible>) – All other visibles to detect collisions against
Returns:

A collision test function that tests the colliding presence (passed to the Collision motion controller) against the visibles listed in the parameter visibles using bounding spheres obtained from the scale field. Collision normals, etc. are reported as if the presence and all visibles are spherical.

Return type:

function(presence)->object

TestSphereToPlanes(planes)
Arguments:
  • planes (Array&lt;object&gt;) – An array of planes to detect collisions against. Each plane is specified as an object with two {@link util.Vec3} fields: <code>anchor</code>, a point on the plane, and <code>normal</code>, a unit vector perpendicular to the plane.
Returns:

A collision test function that tests the colliding presence (passed to the Collision motion controller) against the visibles listed in <code>visibles</code> using bounding spheres obtained from the <code>scale</code> field. Collision normals, etc. are reported as if the presence is spherical.

Return type:

function(presence)->object