Multiple Bodies, Multiple Collision Filters?

I could swear that I have done this before… shouldn’t multi-body physics elements each be able to utilize their respective collision filters?

 gfxElem.collisionFilter = {categoryBits = 16, maskBits = 2062} --30 if want peep coll  
 gfxElem.tapeFilter = {categoryBits = 64, maskBits = 2056}  
 local peepFeetShape = NWCommon:CreatePhysicsBody("feet", inProps.width, inProps.height)  
  
 physics.addBody(gfxElem, inProps.physicstype,   
 {isSensor=inProps.issensor, density=inProps.density, friction=inProps.friction, bounce=inProps.bounce, filter=gfxElem.collisionFilter},  
 {isSensor=true, density=inProps.density, friction=inProps.friction, bounce=inProps.bounce, shape=peepFeetShape, filter=gfxElem.tapeFilter}  
 )  

If someone could glance this over and give me a kick I would appreciate it. :slight_smile: [import]uid: 21331 topic_id: 26835 reply_id: 326835[/import]

Logically this SHOULD work, but I wouldn’t be shocked if the entire body “inherits” the collision filter of the first defined shape/piece. If this is true (and I’m not saying with authority that it is), you can post-filter your collision using the numerical body ID associated with each piece of a multi-element body.

For example, “head” is part #1, “feet” is part #2. The body registers collisions as a whole, then you just check if the collision involved the correct part (and just skip/return if not). It’s not necessarily the most developer-friendly method, but certainly a valid workaround. :slight_smile:

Brent Sorrentino
Ignis Design [import]uid: 9747 topic_id: 26835 reply_id: 109002[/import]

OK. Ya, that is the behavior I’m seeing.

I use element detection now, thanks though.

And thank you for the sanity check!! [import]uid: 21331 topic_id: 26835 reply_id: 109112[/import]