Resolving collision for a primitive in a single frame (PhysX 3.2.3)

Hello,

In PhysX 2.8.4 I was able to accomplish the following and I was wondering what might be the best way to do this in 3.2.3.

In order for my character controller to be able to robustly respond to being pushed by a kinematic object I have created a dynamic capsule of the same dimensions as my controller and placed it at the controller location each frame before the physics update. After the update I read back the location of the dynamic object and adjust the position of my controller accordingly. This worked great in PhysX 2.8.4… I could have multiple kinematic actors pushing my character controller in this manner, even arbitrary trimeshes. In 2.8.4 I created this dynamic proxy object with the FREEZE_ROT flags so that the actor would respond by translating only… since the character controller always stays upright. Also I would zero out the linear and angular velocities after each frame.

Now that I’ve upgraded to 3.2.3 I’m trying to find the best way to accomplish this once again. A few things I’ve tried…

  • Creating the dynamic proxy with a D6 joint to limit the rotation and emulate the FROZEN_ROT flags of 2.8.4 (This somewhat works but sometimes you still see the volume tipping over, and it doesn’t resolve the collision completely each frame anymore… thus zeroing out the linear velocity each frame results in the volume getting pushed in a very jittery manner)

  • Resolving the penetration in myself outside of the simulation…
    This seems to be somewhat promising as it’s not forcing the simulation to do something it’s not really meant to do. I’m using the ::mtd functions for primitives and they seem to work somewhat well.

Does anyone have advice for how I would go about this “properly”? How can I get the simulation to resolve the collisions completely during one update … or alternatively what would be the best way to accomplish this outside the simulation. The way I went about it in 2.8.4 gave really nice results as it only translated the capsule without tipping it over. And also it resulted in a nice sliding feel when the kinematic “pushing” actor was rotating against it. IE it wasn’t acting as if the actor was parented during the collision resolve.

Thanks in advance for any help you can provide,
Randall

Hi,

hm. Did I understand you correctly:
All you want is that your PxController is pushed correctly by an kinematic PxActor -
like you stand on a platform which rotates - and moves up. ( See the example SampleBridgesCCT )
Then - there is a better way to do it.
Why should you teleport your PxController to a new position which you get from another shape which
do another collision with your scene? ( Double traffic :( )

Look at the example SampleBridgesCCT - they use the platform as an obstacle.
Very nice way but you must “mark” each shape as an obstacle - when you only have
some elevators its the best way to do it I guess.
But when you have a lot of kinematic actors which should be able to push your PxController,
you could raise the PxSceneDesc::flags = PxSceneFlag::eENABLE_KINEMATIC_PAIRS flag.
This will produce more stress on the solver I think.

I hope you update your PhysXUpdate ( simulate(), fetch() ) more than once…
-> Use a fixed small timestep and an accumulator for it which updates your PhysX multiple
depends on your delta time.

Maybe this is an answer for you.