fabmax / physx-js-webidl

Javascript WASM bindings for Nvidia PhysX
MIT License
117 stars 27 forks source link

help about ccd #23

Closed lo-th closed 1 year ago

lo-th commented 1 year ago

Hello me again :)

i need help to enable ccd collision ccd need custom scene filterShader with pairFlags |= PxPairFlag::eDETECT_CCD_CONTACT;

but i dont find a way to make custom filter shader

let sceneDesc = new PhysX.PxSceneDesc( tolerances ); sceneDesc.set_filterShader(PhysX.PxTopLevelFunctions.prototype.DefaultFilterShader());

i see PhysX.PxTopLevelFunctions.prototype.setupPassThroughFilterShader but ?

any idea

fabmax commented 1 year ago

The default filter shader takes additional flags from word2 of the actor's simulation filter data (see here).

So all you need to do to enable CCD is to set the ENABLE_CCD flags in your PxSceneDesc and PxRigidBody.setRigidBodyFlag() and then something like actor.simulationFilterData.word2 = _emscripten_enum_PxPairFlagEnum_eDETECT_CCD_CONTACT()

lo-th commented 1 year ago

mm i try with word2 ; SOLVE_CONTACT | DETECT_DISCRETE_CONTACT | DETECT_CCD_CONTACT but seem's don't work ?

fabmax commented 1 year ago

It should work (I use it that way). Did you also enable PxSceneFlag.eENABLE_CCD in your scene and PxRigidBodyFlag.eENABLE_CCD on your bodies?

lo-th commented 1 year ago

ok i find thank's for help i use the body flag on scene :) now that work perfect