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