Obi Official Forum
Help Resetting the Obi.Collider - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Help Resetting the Obi.Collider (/thread-654.html)



Resetting the Obi.Collider - Jaydena - 17-08-2018

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!


RE: Resetting the Obi.Collider - josemendez - 17-08-2018

(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/showthread.php?tid=636&highlight=Mesh+collider


RE: Resetting the Obi.Collider - Jaydena - 20-08-2018

(17-08-2018, 08:52 AM)josemendez Wrote: Hi!

I believe you will find your answer in this thread:
http://obi.virtualmethodstudio.com/forum/showthread.php?tid=636&highlight=Mesh+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!


RE: Resetting the Obi.Collider - Jaydena - 21-08-2018

(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!