Modify collision filter properties after physics body creation

Currently the inability to do this is causing me to have an issue in game implementation. There is a discussion in developer support :

http://developer.anscamobile.com/forum/2012/03/07/platform-can-jump-below-and-land-top

Current implementations only work in certain situations. My diagrams in the thread illustrate the situations in which all these implementations fail (http://i.imgur.com/sCmzP.jpg).

At the moment the only workaround to this I can see is destroying and recreating each body. This has been mentioned to cause a performance hit…

Historical threads of same issue:

http://developer.anscamobile.com/forum/2010/11/08/changing-collision-filters-after-physics-object-created

http://developer.anscamobile.com/forum/2011/06/14/set-box2d-collision-filtergroupindex-after-physics-body-added

http://developer.anscamobile.com/forum/2011/06/14/set-box2d-collision-filtergroupindex-after-physics-body-added

http://developer.anscamobile.com/forum/2011/02/06/set-collision-filter-after-body-added

http://developer.anscamobile.com/forum/2012/01/03/change-filter-criteria-collision [import]uid: 118687 topic_id: 22998 reply_id: 322998[/import]

Supporting.

I would like to be able to change density/bounce of an object after its collision. Without this, physics engine looks pretty lame and basic. No dynamic stuff possible that much. [import]uid: 141449 topic_id: 22998 reply_id: 101401[/import]

+1

In one of those older threads was mentioned another possible solution depending on your needs. I want an enemy to no longer collide with the player and fall of screen.

Setting myEnemyBody.isSensor = true removes the object from future collisions with anything unless isSensor is reset to false.

It’s hackish, but works for what I need. I’m lucky I’m not doing something more complicated… [import]uid: 135733 topic_id: 22998 reply_id: 105373[/import]