Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Offline Rendering] update Mesh Colliders
#1
Hi, I've been using Obi Fluid since many month now, it's an awesome asset and I love it.

Recently, I started a project and I attempt to build an environment in Unity to do Offline Rendering to animate sequences.

For the scenes with fluids, I found that the Obi Fluid solution is absolutly perfect.
I've succedded in making a really simple script to bake a mesh collider that updates every frames. 

Code:
Mesh colliderMesh = new Mesh();
       meshRenderer.BakeMesh(colliderMesh);
       Mcollider.sharedMesh = null;
       Mcollider.sharedMesh = colliderMesh;

[Image: AVS9ZdR.gif]

here's the result. (the model is from Rascal asset but there's absolutly no connection with the current problem)

As you can see, the Obi collider component attached to the object with the Mesh Collider does not updates the collisions with the fluid.

Is there any way I should be able to make it consider the updated mesh ? 
(Keep in mind it's for an Offline solution, so computation time is not really an issue here)

thanks !

[EDIT]


I finally found a quick solution wich give this result : 
https://imgur.com/a/tH66fwz

To do this, I simply modified the Obi Collider script, including an Update() function wich contained two things : 

- Getting the Mesh Collider component mesh
- Setting it as the current Source Collider.

Last question : it is possible to get informations when a particle collide on a surface ? 
Like to trigger an action (I would like to apply a decal to the collided object to simulate a wet surface)
Reply
#2
(08-05-2020, 07:42 PM)kouglov Wrote: Last question : it is possible to get informations when a particle collide on a surface ? 
Like to trigger an action (I would like to apply a decal to the collided object to simulate a wet surface)

Hi there!

Yes, you can get a list of all contacts generated each frame. To do that, subscribe to the solver's OnCollision event. See:
http://obi.virtualmethodstudio.com/tutor...sions.html
Reply