fabmax / physx-jni

Java JNI bindings for Nvidia PhysX
MIT License
85 stars 8 forks source link

Enabling CCD (Continuous Collision Detection) #42

Closed haubna closed 1 year ago

haubna commented 1 year ago

Is there currently a way to enable CCD? I couldn't find a solution on how to enable the Pair Flag eDETECT_CCD_CONTACT for the Filter Shader.

As described here: https://gameworksdocs.nvidia.com/PhysX/4.0/documentation/PhysXGuide/Manual/AdvancedCollisionDetection.html#continuous-collision-detection

fabmax commented 1 year ago

The default filter shader sets the flags present in word2 of the PxFilterDatas of the involved collision objects: https://github.com/fabmax/PhysX/blob/5951e9dbe1e4d003bb7524cfa6aeca19356dc838/physx/source/physxwebbindings/src/PhysXJs.h#L170

So it should be sufficient to set the eDETECT_CCD_CONTACT flag in the simulation filter data of your actors. I'm actually using this in my engine.

haubna commented 1 year ago

Perfect, thanks!