24-01-2022, 02:10 PM
(21-01-2022, 06:12 PM)josemendez Wrote: Depends on the mesh colliders, how many triangles each?
There are 49 mesh colliders, with an average of 103 triangles for one collider.
(21-01-2022, 06:12 PM)josemendez Wrote: Bounding Volume Hierarchies. It's the acceleration data structure used to perform collision queries against triangle meshes.
Since testing each particle against each individual triangle in each collider is too much work, a BVH for each mesh is generated. This allows to quickly prune triangles that are not close to a given particle, and allows to test each particle agains just a few (2-3) triangles. Basically, it makes collision detection fast enough to run in realtime.
The thing is that generating the BVH takes some time. In Obi a better alternative to MeshColliders are distance fields, since A) they're built at edit time and stored in disk, so no runtime overhead B) they're faster and more robust than MeshColliders.
Thanks for this small lesson, I have never studied how collision detection works.
However, I test my asset with or without the mesh colliders, and the performances seems to be approximately the same. This is why it doesn't seems to me that colliders are the cause of these problems in performances.