Problems with isSensor

In my game, the hero is a multiple element dynamic body that is besieged with static enemies, animated by transitions to move across the screen.   I just implemented an invisibility mode, where the hero won’t be affected by enemies, and in that mode I set hero.isSensor = true.

However, on collisions he still gets moved.   

I print out his isSensor property every frame and it’s “true”, but there he goes, shoved unceremoniously across the screen.

Am I misunderstanding isSensor?    Do I have to make the enemies sensors, too?

Using the latest public build.   

Hi Dave,

When you set up the hero’s body initially, do you declare some parts as sensors and others not? Or are they all non-sensor? When you set .isSensor to “true”, it should override any sensor setting you made on individual parts, meaning the entire body should be affected… so this sounds odd that you’re still getting collisions.

Can you post some code for the body setup, and anything else relevant?

Thanks,

Brent

All nine elements are not sensors in the original setup, which is published from the Physics Editor.    

Anyway, after thinking about it, there is really no reason for him NOT to be a sensor at all times.   I check what he collided with (enemy, power up, etc) in his collision handler and do what I need to do.

And happily if I set isSensor = true just after attaching the body upon his creation, it works fine.    

Hi Dave,

When you set up the hero’s body initially, do you declare some parts as sensors and others not? Or are they all non-sensor? When you set .isSensor to “true”, it should override any sensor setting you made on individual parts, meaning the entire body should be affected… so this sounds odd that you’re still getting collisions.

Can you post some code for the body setup, and anything else relevant?

Thanks,

Brent

All nine elements are not sensors in the original setup, which is published from the Physics Editor.    

Anyway, after thinking about it, there is really no reason for him NOT to be a sensor at all times.   I check what he collided with (enemy, power up, etc) in his collision handler and do what I need to do.

And happily if I set isSensor = true just after attaching the body upon his creation, it works fine.