R3d.World:setEventListener
From GiderosMobile
Available since: Gideros 2019.10
Class: R3d.World
Description
Sets the event listener for the collisions in the world.
r3d.World:setEventListener(listener)
Note: this function is called every physics steps so you should not use it in your game loop (e.g. Event.ENTER_FRAME) but rather call it only once on init
Parameters
listener: (function) the function to listen for collisions in the world
Example
function listener(e)
if e == "beginContact" then
print("beginContact", e, math.random(100))
elseif e == "endContact" then
print("endContact", e, math.random(100))
end
end
world:setEventListener(listener) -- updated
- R3d.World
- R3d.World.new
- R3d.World:createBallAndSocketJoint
- R3d.World:createBody
- R3d.World:createFixedJoint
- R3d.World:createHingeJoint
- R3d.World:createSliderJoint
- R3d.World:destroyBody
- R3d.World:destroyJoint
- R3d.World:getGravity
- R3d.World:raycast
- R3d.World:setEventListener
- R3d.World:setGravity
- R3d.World:step
- R3d.World:testCollision
- R3d.World:testOverlap