Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Adding ObiColider To Generated Mesh Is Slow
#4
(08-08-2025, 11:25 AM)aderae Wrote: Hello,

I am procedurally generating my world in 256x256 mesh chunks and whenever player is on one chunk, I am adding ObiCollider to it. However this blocks the main thread for a second and locks the game.

Is there a way to do this in Jobs system inside a thread?

Thanks!

Hi!

Creating a MeshCollider involves building the spatial acceleration structure for it (bounding interval hierarchy, in Obi's case) which takes some time. This is currently done in the main thread.

The hierarchy is created in ObiTriangleMeshContainer.cs (by calling the BIH.Build() method) every time a new MeshCollider gets a ObiCollider component added to it. You could try modifying this file to use a job or a coroutine, in that case special care should be taken to make sure particles can't actually approach the collider before its creation is finished - otherwise they'll ignore it.

kind regards,
Reply


Messages In This Thread
RE: Adding ObiColider To Generated Mesh Is Slow - by josemendez - 08-08-2025, 12:58 PM