Simple question regarding collisions, probably regarding to collisionBit.

Hi there,

wouldn’t it help just to check if event.contact exists and only if it does to set event.contact.isEnabled ?

Also I assume you won’t notice that one missing event, cause you got plenty of preCollision events for a single collision event.

if event.contact then event.contact.isEnabled = false end

Greetings

Torben

No because even checking something that is “nil” will throw system exceptions and may lead to crashes and more importantly will affect the game because the moment that I don’t disable the contact, the collision will get handled and object will get destroyed.

I “solved” this by setting isSensor to true and doing some other dirty work but I’m very unhappy with things I learned about Corona and events that it misses and other bugs that I faced in past 3 days which I don’t believe were from my side because I based Corona blog posts and documentations on them.

Sorry but that’s definetly not true.

If I check for a variable that doesn’t exist, the system won’t chrash. You can print it as well.

The only problem you could have is, if the variable you’re checking is a table entry and the table does not exist.

[LUA]

local variable = nil

print(variable)  --> nil

local table = nil

print(table.variable)  --> Will crash the system. Some error like “Tried to index field … does not exist”

[/LUA]

Did you test what I mentioned? Especially the point that you get several precollision events for one collision event?

my question is why does the app think “contact” is a field?

hi Jedi, can you share the “dirty work”? I don’t want to nil out contact either since its firing is crucial to the success of my app. why should contact ever be seen as nil if it’s part of Corona lua’s api? I think there’s a glitch in the matrix…

my question is why does the app think “contact” is a field?

hi Jedi, can you share the “dirty work”? I don’t want to nil out contact either since its firing is crucial to the success of my app. why should contact ever be seen as nil if it’s part of Corona lua’s api? I think there’s a glitch in the matrix…