Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Correct way to update mesh colliders for Obi Fluids
#1
Hello,

I'm trying to make Obi Fluids interact with Voxelica voxel engine, which generates chunk-based mesh colliders at runtime. However, as the Mesh objects are being modified on the Mesh Colliders, Obi Solver doesn't seem to pick up on the change. I tried manually forcing an update with several different methods in the Obi interfaces but had no luck so far. I also noticed that the GPU Solver and CPU Solver behaved differently, where CPU solvers was able to pick up on the changes with a specific combination of calls but GPU Solver wasn't. Sorry that I don't have the specific methods in mind at the moment, but I'm hoping that you can point me in the right direction.

Thanks!
Reply
#2
(06-12-2025, 11:39 AM)Voxelboy Wrote: Hello,

I'm trying to make Obi Fluids interact with Voxelica voxel engine, which generates chunk-based mesh colliders at runtime. However, as the Mesh objects are being modified on the Mesh Colliders, Obi Solver doesn't seem to pick up on the change. I tried manually forcing an update with several different methods in the Obi interfaces but had no luck so far. I also noticed that the GPU Solver and CPU Solver behaved differently, where CPU solvers was able to pick up on the changes with a specific combination of calls but GPU Solver wasn't. Sorry that I don't have the specific methods in mind at the moment, but I'm hoping that you can point me in the right direction.

Thanks!

Hi!

Calling ObiMeshShapeTracker. UpdateMeshData() should be enough for both GPU and CPU, like this:

Code:
((ObiMeshShapeTracker)yourCollider.Tracker).UpdateMeshData()

Note this is a considerably expensive operation, so it shouldn't be called every frame.

(As a side note, you have private messaging disabled in your forum user settings so I couldn't answer to your PM. You posted this question on friday and we're away for the weekend, so just saw both your PM and this forum post)

kind regards,
Reply
#3
Thanks for the response. I've made a repro project and shared it with you via PM (and also enabled receiving PMs in my user settings, thanks for the heads up).
Reply
#4
Hello,

I have observed the exact same issue, where I also use:
Code:
((ObiMeshShapeTracker)yourCollider.Tracker).UpdateMeshData()

But when using GPU mode, the update doesn't seem to properly work or register, while when using the CPU-mode it works flawlessly.

I notice the same when switching colliders on/off, where it is very "flaky" in GPU-mode. I especially observed it with meshcolliders, where it seems to sometimes retain "stale" data, so it looks like its still kinda colliding with the old collider? (very hard to describe what exactly is happening) 

So far I have tried a couple of possible workarounds, like deferring the meshdata update by one frame after enabling the collider, but that also didn't fix the issue.


As an explanation of my scene, I only have 1 obiCollider active at a time in my scene and switch between those, through this function:
Code:
        private void SetObiColliderEnabled(bool enabled)
        {
            if(_obiCollider == null) {
                _obiCollider = GetComponentInChildren<Obi.ObiCollider>();
            }
            _obiCollider.enabled = enabled;
            if(enabled)
                ((Obi.ObiMeshShapeTracker)_obiCollider.Tracker).UpdateMeshData();
        }


where I disable the currently active collider first and then enable the new collider. I added the UpdateMeshData function later due to this forum post, but even with it added, the functionality did not get fixed.


I really want to use GPU mode, since it has vastly superior performance for my use-case and also looks better, but this collision issue might be a deal-breaker for me, since it is very important for my program that collision works properly.


I am running Obi Fluids 7.1.1 on Unity 6000.3.19f1

Here is also a video where I showcase this issue:
Reply
#5
Hi!

Not entirely sure if this is one MeshCollider and you’re modifying its mesh data like the thread author did (hence the UpdateMeshData call, which triggers a costly recalculation of all mesh vertices/triangles), if they are completely distinct colliders that you’re swapping, or some combination of both.

Could you send a repro project to support(at) virtualmethodstudio.com so we can take a closer look? Thanks!
Reply
#6
(21-08-2026, 11:38 PM)josemendez Wrote: Hi!

Not entirely sure if this is one MeshCollider and you’re modifying its mesh data like the thread author did (hence the UpdateMeshData call, which triggers a costly recalculation of all mesh vertices/triangles), if they are completely distinct colliders that you’re swapping, or some combination of both.

Could you send a repro project to support(at) virtualmethodstudio.com so we can take a closer look? Thanks!
Hey!

In the video I provided, I am just toggling on and off the gameobjects with their own Obi colliders (I added the explicit disabling and enabling of the component, to try to fix the issue that I encountered, but it didn't help).

But I also have one mode, where a collider is continuously being updated (not shown in the video, it was the VTS-Outline mode that wasn't shown). Both the swapping of gameobjects AND the updating of mesh data don't work in compute mode and work when using Burst, which leads to me to believe there is an issue with sending the collider data to the shader? Although this is just my assumption from a outside point of view (no idea how obi works internally obviously).

I will create a repro project, once I can find the time to help with fixing this issue ASAP!
Reply
#7
(23-08-2026, 09:43 PM)Remasuri3 Wrote: I will create a repro project, once I can find the time to help with fixing this issue ASAP!

Received the repro project, could reproduce the issue, and identified the cause. Will share a patch shortly.

Thanks for reporting this!
Reply