physx-js
physx-js copied to clipboard
Collision detection does not work with versions > 0.0.6
Hi!
I am a very beginner with JS and webpack so I may just be doing something wrong. I tried the following steps:
- Cloned this repo.
-
cd example
-
npm install
-
npm run start
.
And I get the expect results with falling cubes hitting the ground.
However, if I modify the package.json
and set the physx-rs
dependency to its latest version 0.0.9, re-run npm install
and npm run start
, I see the falling cubes but they just pass through the ground instead of hitting it. Is there some additional PhysX scene configuration do to in order to make the version 0.0.9 of physx-rs
work?
I believe the recent version includes filtering now. That requires you to set a group and a mask for your shape. You can read the how to set up filtering in the manual here: https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/Manual/RigidBodyCollision.html
I also made an example with Playcanvas. You can check how I set filters here: https://playcanvas.com/project/737359/overview/playcanvas-with-nvidia-physx
const setupFiltering = function(shape, group, mask) {
const filterData = new PhysX.PxFilterData(group, mask, 0, 0);
shape.setSimulationFilterData(filterData);
};