Lets say there is “water” in a still cup (water is also still) and the cup starts to move (there is a force applied to the water in the opposite direction of the cup movement) and then the cup hits a wall (water splashes up and possibly out of the cup). Would this be possible to simulate?
I have tried looking this situation up on google and on this site but did not get a clear answer.
I do understand that simulating water physics is very complex and would require collisions between each particle to exist. Not sure if this type of situation would require physics for the water or if it could be resolved in a round about way
New to the website and unity. Appreciate any sort of help given!
there is a force applied to the water in the opposite direction of the cup movement)
not true actually, the water is inert. And there is a force applied to the water in movement direction (from the back wall of the cup). But to your problem:
You want to simulate the water as particles. Think about filling a cup not with water but with many, tiny spheres (you can think about it as water molecules). With these spheres you can simulate inertia and forces to the water. And with an shader you make it look like water.
But this isn’t that easy, and can really be an hit to performance. You should consider faking it, instead simulating it:
The water in the cup being just a plane with many vertices. Everytime a force is applied to the cup you manipulate the water-plane-vertices. Reducing the height of some at the front (nearest to movement direction) and increasing the height at the end. the height of all vertices added together needs to stay constant.
This isn’t easy either, because it needs some afford to make it look nice and realistic.
To my knowledge, there is no physics of particules (water, sand, …) in Unity (yet?) !
However, you can still achieve some cool stuff using Particle Systems (the same way you do smoke, fire, …): every time your cup hit the wall you throw a water effect.
More informations:
- YouTube (you’ll find dozens of tutos on Youtube)