- Home /
How do you simulate a liquid inside a bottle using Unity?
I need bottles to be filled with liquid in UNITY 3D. As Unity doesn't have liquids, I need to simulate them. Can you suggest me on how I can achieve these following functionalities with liquid simulation :
3D Object with any shape (Bottle, Conical flask, beaker etc) must be filled with liquid. The volume of liquid to be filled is a variable, which will be decided by the user.
When I tilt/rotate the object, physics must act upon the liquid inside the object as shown in the figure. Liquid inside a bottle and it has to move depending on how the bottle is positioned in 3D. image_1, image_2
I had tried with Stencil buffers, particle system, Cloth component etc. But couldn't achieve with any of them.
The problem with particle system is that, it is heavy performance and the particles are leaking out from the sharp edges of the GameObject's mesh, even though the Collision is enabled for the particle system. With stencil buffers, I didn't understand how liquid inside a object can move depending upon the positioning of the object.
Any suggestions or solutions are appreciated. Thanks in advance !
Answer by tanoshimi · Sep 01, 2016 at 04:06 PM
I'd use metaballs to merge simple sphere meshes together.
@tanoshimi Aren't the metaballs causing a huge impact on performance ? Anyways if you do have a script, can you please share, I will look at it once.
Your answer
Follow this Question
Related Questions
Apply texture to a particle under LWRP 0 Answers
Generating Textures in Shaders? 1 Answer
alpha mask on a 0 Answers
Having texture problem in Safari iMac 0 Answers
Texture not mapped to UV CG shader 1 Answer