I want to temporarily disable collisions for projectiles and the like after spawning (potentially) within the bounds of the parent-object. Once the objects are sperated or if there was no initial intersection at all, I want to reenable collisions for that pair. The only way to do that I can think of right now would be to use shape-filter.data for that purpose and suppress collisions inside the filter-shader and send a notify-call on seperation, but that wouldn't be very elegant and I also wouldn't know, how to deal with the case, when the projectile is already seperated from the parent on spawning. Any ideas?
PhysX 3: disabling collisions for a pair of shapes or actors?
Started by Max Power, Sep 14 2012 03:59 PM
2 replies to this topic
Sponsor:
#2 GDNet+ - Reputation: 1751
Posted 15 September 2012 - 12:51 AM
If at least one of the objects is kinematic then it could ignore collisions after they are signaled.
For DYNamic objects, I have no idea as any kind of filtering will require quite some checks. I'm looking this thread as I'm interested.
For DYNamic objects, I have no idea as any kind of filtering will require quite some checks. I'm looking this thread as I'm interested.
#3 Members - Reputation: 121
Posted 17 September 2012 - 04:24 AM
Ok, so I finally gave it a try this morning and here is what I've done.
I use words 2 and 3 of shape-filter-data as unique identifiers for the game-object (word2) that the shape(s) belong to and for the parent-object (word3), if I want to suppress initial-overlap collisions. I decided to use adresses as IDs and set them up in my objects' contruction with optional parent as parameter.
I had to derive from PxSimulationFilterCallback and use it in my scene-descriptor for the whole thing to work, even though I only implemented empty placeholder-functions.
Then inside the filter shader, for shape-pairs where data0-word2 == data1-word3 or the other way around, I raise the pairFlag eNOTIFY_TOUCH_LOST and return the filterFlags eKILL | eNOTIFY. This supresses the collision and makes sure that after seperation, the pair doesn't get ignored by the filter-shader anymore.
In my simulation order I let physx do exactly one simulation-step after I create new objects and setup their shape-filter-data and before I reset filter-word3 of every newly created shape back to zero. That means that the next time they collide, there is no parent-object to ignore collisions with anymore, regardless wether there was an initial overlap in the first frame or not.
I don't know, if there is a more efficient way of handling this, but it works for me without problems. Hope it helps!
I use words 2 and 3 of shape-filter-data as unique identifiers for the game-object (word2) that the shape(s) belong to and for the parent-object (word3), if I want to suppress initial-overlap collisions. I decided to use adresses as IDs and set them up in my objects' contruction with optional parent as parameter.
I had to derive from PxSimulationFilterCallback and use it in my scene-descriptor for the whole thing to work, even though I only implemented empty placeholder-functions.
Then inside the filter shader, for shape-pairs where data0-word2 == data1-word3 or the other way around, I raise the pairFlag eNOTIFY_TOUCH_LOST and return the filterFlags eKILL | eNOTIFY. This supresses the collision and makes sure that after seperation, the pair doesn't get ignored by the filter-shader anymore.
In my simulation order I let physx do exactly one simulation-step after I create new objects and setup their shape-filter-data and before I reset filter-word3 of every newly created shape back to zero. That means that the next time they collide, there is no parent-object to ignore collisions with anymore, regardless wether there was an initial overlap in the first frame or not.
I don't know, if there is a more efficient way of handling this, but it works for me without problems. Hope it helps!






