react-three-rapier icon indicating copy to clipboard operation
react-three-rapier copied to clipboard

Performance issue with a custom collider

Open myznikovgleb opened this issue 1 year ago • 2 comments

Description

I ran into a issue where a dynamic rigid body with a custom collider falls through another fixed rigid body containing a lot of meshes. The first rigid body can represent a character, the latter one can represent a map with obstacles. It is regularly reproduced only if the map contains a significant (about 1000) amount of meshes

There is one peculiarity, a dynamic rigid body with an automatic collider behaves correct and does not fall through the map

Example

I've made a sandbox to reproduce the issue. Link below https://codesandbox.io/p/sandbox/mc6qdr

Solution

Initially, I thought that that issue was caused by improper assets loading. Because I faced something similar to https://github.com/pmndrs/react-three-rapier/discussions/522. But it seems to be a wrong direction. The issue is reproduced even without external assets. And the example above also does not contain any assets

For now, I have only one solution. I use a dynamic rigid body with an automatic collider instead of a custom one. Check the sandbox or docs https://github.com/pmndrs/react-three-rapier?tab=readme-ov-file#automatic-colliders

It would be great to investigate reasons of the issue and fix it. Or at least find a more subtle solution. Any help appreciated!

myznikovgleb avatar Sep 08 '24 12:09 myznikovgleb

Hey, a bit late to the party but: were you able to find a solution for this @myznikovgleb ?

pierroo avatar Mar 20 '25 15:03 pierroo

Hi! @pierroo

No, I've ended up with the solution described above. It is not so subtle as desired though

I also have noticed that the demo above is required a dynamic adjustment of a map size to reproduce the issue depending on a client device performance. I've slightly increased it for now

myznikovgleb avatar Mar 23 '25 09:03 myznikovgleb