I'm trying to solve a problem with collisions. I would like to pass throu certain objects (spikes(trap triggers), enemies, etc...), but thing is I have no clue how
to do that and wasn't able to find a solution.
The only thing I was able to come up with is this:
Code: Select all
function preSolve(a, b, coll)
if a:getUserData() == "player" then
if b:getUserData() == "spike" then
coll:setEnable(false)
end
end
end
And fo course I would like to know, If there is more elegant way, how to deal with "ghost" objects.
Thank you.
PS: Traps are those levitating rectangles
Edit: I changed player and enemy object into square, but that got me a proper error :