Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Resetting the Obi.Collider
#1
Hello!

My current fluid setup uses a mesh collider with the obi collider. When the mesh changes the obi.collider does not. The workaround i found for this is to delete the obi.collider and then re-add it, all in the same frame. This updates the obi.collider with the new mesh and everything works well.

A problem I encountered with this is that the destroyed obi.collider still maintains a reference to an object somewhere and therefore doesn't get fully destroyed by the Garbage collector and slowly adds to the memory until it crashes.

I've tried removing the 'Source Collider' in the Obi.Collider and re-adding it, but this just seems to disable the obi.collider entirely.

Is there a way that i can 'reset' the Obi.Collider once changes in the Mesh collider have been made?

Thank you!
Reply
#2
(17-08-2018, 04:57 AM)Jaydena Wrote: Hello!

My current fluid setup uses a mesh collider with the obi collider. When the mesh changes the obi.collider does not. The workaround i found for this is to delete the obi.collider and then re-add it, all in the same frame. This updates the obi.collider with the new mesh and everything works well.

A problem I encountered with this is that the destroyed obi.collider still maintains a reference to an object somewhere and therefore doesn't get fully destroyed by the Garbage collector and slowly adds to the memory until it crashes.

I've tried removing the 'Source Collider' in the Obi.Collider and re-adding it, but this just seems to disable the obi.collider entirely.

Is there a way that i can 'reset' the Obi.Collider once changes in the Mesh collider have been made?

Thank you!

Hi!

I believe you will find your answer in this thread:
http://obi.virtualmethodstudio.com/forum...h+collider
Reply
#3
(17-08-2018, 08:52 AM)josemendez Wrote: Hi!

I believe you will find your answer in this thread:
http://obi.virtualmethodstudio.com/forum...h+collider

Thank you! this solution works a treat, but unfortunately it still creates a memory leak :/

I'm assuming in the UpdateMeshData function, a reference is created that doesn't allow the GC to remove the previous obicollider information.

Is there a way to call this action without slowly increasing the memory usage?

Thank you!
Reply
#4
(20-08-2018, 04:11 AM)Jaydena Wrote: Thank you! this solution works a treat, but unfortunately it still creates a memory leak :/

I'm assuming in the UpdateMeshData function, a reference is created that doesn't allow the GC to remove the previous obicollider information.

Is there a way to call this action without slowly increasing the memory usage?

Thank you!

I solved the memory growth problem by commenting out the following 2 lines in ObiMeshShapeTracker.cs:

Line 83. meshDataCache[mesh] = handles;
Line 87. newHandles.Ref();

While i'm sure this creates some internal conflicts for Obi, all the fluid dynamics and mesh tracking seems to be working normally and without any problems.

Let me know if there's a safer way, but for now this solves the problem  Sonrisa 

Cheers!
Reply