How right you are sir. Sorry I did not pay better attention. I have been noticing ALOT of issues as of late, but maybe we are just not understanding this correctly. I even tried doing multiple elements (a buffer around the object to grab a collision sooner) but no joy.
Could someone please explain why the collision hits before the preCollision in the following code…
local physics = require("physics")
local screenW = display.contentWidth
local screenH = display.contentHeight
physics.start()
physics.setDrawMode("hybrid")
local bar = display.newRect(0, screenH - 10, screenW, 10)
physics.addBody(bar, "static", {isSensor=false, density=10.0, friction=0.0})
local circle = display.newCircle(200, 20, 10)
physics.addBody(circle, "dynamic", {isSensor=false, density=10.0, friction=1.0})
local function preCollision (self, event)
print("firing preCollision")
return true
end
local function collision(self, event)
print("firing collision")
return true
end
circle.preCollision = preCollision
circle.collision = collision
circle:addEventListener("preCollision", circle)
circle:addEventListener("collision", circle)
[import]uid: 21331 topic_id: 23841 reply_id: 96097[/import]