Table Of Contents

Previous topic

motion.Acceleration

Next topic

motion.ForceTorque

This Page

motion.Collision

Constructor

class motion.Collision(presence, testFn, responseFn, period)

Bases: motion.Motion()

Arguments:
  • presence (presence) – The presence whose collisions are to be detected (the “colliding presence”)
  • testFn (function(presence)->object) – A function that should detect any collisions when called repeatedly and return one in the form of a “collision object”
  • responseFn (function(presence|object)->undefined) – A function to be called when a collision happens
  • period (number) – (optional =defaultPeriod) The period at which to check for collisions

Methods

responseFn(pres, collision)
Arguments:

The function that the collision controller calls when a collision occurs. May be safely replaced dynamically.

testFn(pres)
Arguments:
  • pres (presence) – The presence to test for collisions
Returns:

A collision object (see <a href=”http://sirikata.com/wiki/index.php?title=User:Wmonroe4/Motion_controllers“>the Sirikata wiki tutorial</a> for the structure of collision objects)

Return type:

object

The function that the collision controller calls to test for collisions every tick. May be safely replaced dynamically.