Difference between revisions of "World:setCallbacks"
m (1 revision: Imported docs from potato.) |
|||
Line 1: | Line 1: | ||
+ | Set functions to be called when shapes collide. | ||
+ | |||
+ | Four Lua functions can be given as arguments. The value nil can be given for events that are uninteresting. | ||
+ | |||
+ | |||
+ | When called, each function will be passed three arguments. The first two arguments (one for each shape) will pass data that has been set with [[Shape:setData]] (or nil). The third argument passes the [[Contact]] between the two shapes. | ||
== Function == | == Function == | ||
Line 16: | Line 22: | ||
* [[parent::World]] | * [[parent::World]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Description=}} | + | {{#set:Description=Set functions to be called when shapes collide. |
+ | }} |
Revision as of 16:17, 14 February 2010
Set functions to be called when shapes collide.
Four Lua functions can be given as arguments. The value nil can be given for events that are uninteresting.
When called, each function will be passed three arguments. The first two arguments (one for each shape) will pass data that has been set with Shape:setData (or nil). The third argument passes the Contact between the two shapes.
Function
Synopsis
World:setCallbacks( add, persist, remove, result )
Arguments
function add
- Called when two shapes first collide.
function persist
- Called each frame, if collision lasts more than 1 frame.
function remove
- Called when two shapes finish colliding.
function result
- No idea. Never seems to be called...
Returns
Nothing.