- Home /
Smoothed Particle Hydrodynamics
Hi Guys.
I'm making a 2D game in Unity that involves absorbing certain liquids (water, lava, acid) and doing stuff with them. I've been looking into fluid simulation techniques and the best one I've come across is Smoothed Particle Hydrodynamics, which basically involves simulating the water using lots of particles that need to interact both with each other and with other stuff in the level.
I've come up with two theoretical ways of proceeding:
Use sphere colliders and rigidbodies on the liquid particles.
Simulate the particle collisions myself and somehow have them interact with other objects in the level.
Using PhysX to simulate the liquid using spheres is highly undesirable from a realism and performance standpoint (particularly since it's a mobile game).
Simulating the particles myself means that I also have to make them interact with other objects. I have no idea how I would "represent" the other objects in the fluid simulation so that the particles not only stay outside the colliders of other objects, but also apply forces to them.
Here are a couple of games I've come across with the sort of liquid physics I want: Pixel Junk Shooter http://www.youtube.com/watch?v=6IsZAa899SY Spewer http://www.newgrounds.com/portal/view/494129
Does anyone know of a good way to do this sort of thing?
Also, if I went with the first method (using sphere colliders) and I froze all of the rotation constraints on the rigidbodies, would it be any more efficient than having them unconstrained? My reasoning is basically that PhysX should be able to tell that two objects are both unable to rotate and thus not bother calculating torque, but I can also see why it might not do that.
Did you ever get this to work? I'm writing a thesis on fluid simulation and for my purposes, SPH in Unity would be far more desirable than a standalone shader.
Your answer
Follow this Question
Related Questions
Freezing X and Y rotation not working (rigidBody) 1 Answer
How can I constrain physics in all directions except one? 2 Answers
Why are a rigidbody's freeze constraints not working? 2 Answers
Add 2d rigidbodies to moving objects to increase performance or not? 1 Answer
Detecting Input on ~100 Objects 2 Answers