problem with spawned objects after adding (e.other.name = "name") in one collision function

Hi,

I  created a function :

[lua]local function onLocalCollision( event )
if ( event.phase == “began” ) then
if (event.other.name == “wall”) then
event.target:removeSelf()
end
end
return true
end[/lua]

but the collision happens only with the wall, avoiding all other spawning objects ?!

What physical body type are the spawned objects? Dynamic or kinematic? I assume you have not yet set up collision filters or anything more advanced?

Brent

And, of course, your conditional check on line #3 will void the collision unless the other object’s .name is “wall”…

spawned objects are “static”, I have not set collision filters

Hi @hammod-930,

Collisions only occur if one (or both) objects are “dynamic”. So you can detect dynamic-dynamic, static-dynamic, or kinematic-dynamic, but not static-static, static-kinematic, or kinematic-kinematic.

Take care,

Brent

What physical body type are the spawned objects? Dynamic or kinematic? I assume you have not yet set up collision filters or anything more advanced?

Brent

And, of course, your conditional check on line #3 will void the collision unless the other object’s .name is “wall”…

spawned objects are “static”, I have not set collision filters

Hi @hammod-930,

Collisions only occur if one (or both) objects are “dynamic”. So you can detect dynamic-dynamic, static-dynamic, or kinematic-dynamic, but not static-static, static-kinematic, or kinematic-kinematic.

Take care,

Brent