Sets functions for the collision callbacks during the world update.
Four Lua functions can be given as arguments. The value nil removes a function.
When called, each function will be passed three arguments. The first two arguments are the colliding fixtures and the third argument is the Contact between them. The postSolve callback additionally gets the normal and tangent impulse for each contact point. See notes.
If you are interested to know when exactly each callback is called, consult a Box2d manual
Available since LÖVE 0.8.0
This method is not supported in earlier versions.
World:setCallbacks( beginContact, endContact, preSolve, postSolve )
function beginContact
function endContact
function preSolve
function postSolve
Nothing.
Removed in LÖVE 0.8.0
This variant is not supported in that and later versions.
World:setCallbacks( add, persist, remove, result )
function add
function persist
function remove
function result
Nothing.
Below are the parameters for the postSolve callback. Note that the numbers of normal and tangent impulse correspond with the numbers of contact points.
function postSolve(fixture1, fixture2, contact, normal_impulse1, tangent_impulse1, normal_impulse2, tangent_impulse2) -- do stuff end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/World:setCallbacks