Recommended Posts

This is a re-creation of my old thread here. I haven't been able to solve this issue and the thread got closed, so here's attempt 2:

My PxRigidDynamic actors intersect with other actors and I can't figure out why. There are still collisions between them, but the rigid dynamic slightly clips through them and is 'pushed' back. Here's a video of it ingame/in the PVD:

The box is a PxRigidDynamic actor.

The player is a PxCapsuleController.

All other actors are PxRigidStatic.

Having CCD disabled or enabled seems to make no difference. (CCD should only affect high-velocity objects anyway, so I doubt that's the cause here)

The collisions between the controller and the static actors are fine, so I don't see why the rigid dynamic would behave any differently.

I'm using PhysX-3.3.0

0

Share this post

Link to post

Share on other sites

Are you calling PxRigidBodyExt::setMassAndUpdateInertia (possibly instead of setMass) after all the shapes have been created? That behaviour in your video is exactly what happens if this call is omitted.

Share this post

Link to post

Share on other sites

Yes, it should be called on dynamic actors only. Otherwise static/dynamic actor initialization should look quite similar. I assume you're not manually applying impulses on the box (at onShapeHit callback)? Does your box behave like that if you're not pushing it with the character controller? Does it penetrate the static actor if it falls? I still suspect there's something wrong with how you're creating your dynamic actors. Even if the cc pushed the box in to the wall/ground, it should jump right off. Post some initialization code maybe so that can be ruled out?

Share this post

Link to post

Share on other sites

Okay, I didn't notice anything odd in the code. But by looking that video I noticed that your world scale is enormous compared to that grid (it's not possible to scale that grid, is it?). What units are you using? It's known that too small units can cause jittering when using inappropriate contact offsets. There's something in the documentation about this and here: http://www.nvidia.com/object/physx_knowledge_base.html (it's for the previous version but probably still valid).

Share this post

Link to post

Share on other sites

1. The way the box falls, it doesn't look like CCD is enabled - are you sure it's enabled in the filter shader as well as the scene and dynamic actor (I can see the flag is these two)? However, this is not the cause of the problem.

2. Your box looks like it's about 50 units across. The contactOffset value is 0.02 which is tiny, in proportion. I'd suggest setting contactOffset to 1. But I don't think this will solve the problem.

3. The scene is reporting gravity as (0,0,0) (and the object has eDISABLE_GRAVITY) - is that right? So you're applying gravity manually? I don't see why you shouldn't - a constant force shouldn't cause penetration problems... but maybe it is.

4. PVD doesn't report the tolerancesScale length/mass values - but it does say the "normal" speed is 10 units/s. When your box falls it his the ground at about 909 units/s

I would:

1. Disable CCD for the moment - it hasn't been reliable in the past (though is probably fine now)

2. Make sure the PxTolerancesScale is set correctly

3. If that doesn't work, see whether it's due to disabling gravity and applying the gravitational force manually (if this is it, it sounds like a PhysX bug).

Share this post

Link to post

Share on other sites

1) The physx::PxSceneFlag::eENABLE_CCD is set in the PxSceneDesc and physx::PxPairFlag::eCCD_LINEAR inside the CCD Filter Shader.

The actor's also have the 'physx::PxRigidBodyFlag::Enum::eENABLE_CCD' and the 'physx::PxRigidBodyFlag::Enum::eENABLE_CCD_FRICTION' flags set.

2) How do I change the contact offset for dynamic actors? 'setContactReportThreshold'?

3) Yes, as I've said, I'm applying my own gravity. I disabled it and tried it with physx' inbuilt gravity as you've suggested, but the result was the same. (Without the below changes)

4) I've changed the values to the following:

length:

From the documentation: "For simulating roughly human-sized in metric units, 1 is a good choice. If simulation is done in centimetres, use 100 instead. This is used to estimate certain length-related tolerances."

Since in my case 1 unit = 19.05mm, I chose 190.5 as an appropriate value.

mass:

"The approximate mass of a length * length * length block. If using metric scale for character sized objects and measuring mass in kilogrammes, 1000 is a good choice."

My measurement is in kilogrammes, so I've set it to 1000.

speed:

"For normal physical environments, a good choice is the approximate speed of an object falling under gravity for one second."

This one's a bit difficult to determine in my case. The gravity can change entirely and there is no 'typical' velocity. I've set it to 180 for now.

That seemed to do the trick, although I can't push the box anymore, even with a low mass: