Advertisement

(directX11 PhysX) How can i get contact position between kinematic actors?

Started by October 17, 2023 07:44 AM
2 comments, last by cww9512 1 year, 2 months ago

Hello, I'm working on a fan-made version of Super Mario Odyssey. I'm using PhysX for physics simulation. The dynamic actors don't behave naturally, so I've mostly been using the kinematic type for most actors.

As you all know, Super Mario has question mark blocks. I want to handle collisions differently when the player collides with the block's top, side, or bottom.

Right now, I'm roughly calculating the collision points internally, but I know it's not a good approach. To achieve what I want, I need to know the collision direction.

I understand that dynamic actors can get collision points from contact information, but kinematic actors can only obtain trigger information.

How can I resolve this issue?

If you implemented a PxSimulationEventCallback you get contact events as well as trigger events. Both these events are between pair of bodies so you have a little info there. I did a quick check and I noticed that PxSimulationEventCallback::onTrigger only gives the trigger pair and no information in regards to the contact. However, PxSimulationEventCallback::onContact does. Could you validate that you are not getting any onContact ‘event’ when your kinematic actor collides with a dynamic actor an vice-versa. Also make sure that collisions are not getting filtered out for your actor pairs.

Advertisement

@cgrant Thank you for replying

I known that kinematic actors cannot trigger the "onContact" function during collisions with other kinematic actors.

In fact, I attempted to call it within my PxQueryFilterCallback filter, but I received a warning stating that "onContact" cannot be used for kinematic-to-kinematic collisions.

This topic is closed to new replies.

Advertisement