"Filling" an object with fluid

I am working on a game that requires a conical flask to be “filled” with a fluid. However, I’m struggling how to accomplish it. The game is in 3D so a 2D plane is not applicable in this case.

I have tried using a particle system but I don’t think I understand the particle system well enough to be able to do what I’m after.

Are there any tutorials that anyone knows of which shows how to “fill” an object internally, like a glass of wine or does anyone know how to do it themselves and are willing to share?

I have found several videos YouTube which show what I’m after, but unfortunately, they have no links on how to do it.

If you take a look at this example, the effect I’m after is the filling of the glass. The pouring of the wine is documented and explained, but I can not for the life of me figure out the all important container filling part.

Any help appreciated, as always.

Real-time fluid dynamics is very complex. There’s an interesting research paper (although now over 10 years old) at http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf

Why do you need the object to be filled? Just for graphical effect, or does it have some impact on the game logic (i.e. do objects need to float on the water surface?)

That video has the source code at the bottom of it although it looks like you have to give them your email address at least to download it.

Really though all you need is some trigger colliders attached to the bottle that can be setActive when pouring. If the collider is hitting the glass then fill the glass.

As @tanoshimi say’s full fluid dynamics is really complex but if you just want the glass to fill then that should allow you to spot when the glass is under the stream of liquid.

It get’s more complex if the bottle can be rotated though as the trigger colliders could well end up pointing upwards so it depends on the flexibility within your game.

If you want help, then share your project details at sales@agicent.com. We are a game development company (https://www.agicent.com) and would like to assist you. Cheers :),In case, you are looking for a game development company (https://www.agicent.com), then we can help you. Share your project details at sales@agicent.com and we will assist you for free.