Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

PhysX 3: disabling collisions for a pair of shapes or actors?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Max Power   Members   -  Reputation: 121

Like
0Likes
Like

Posted 14 September 2012 - 03:59 PM

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?

Sponsor:

#2 Krohm   GDNet+   -  Reputation: 1751

Like
0Likes
Like

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.

#3 Max Power   Members   -  Reputation: 121

Like
1Likes
Like

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!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS