I created a quick prototype of a realtime liquid simulation for a project over at Chiat a couple weeks ago. The result might not be very realistic, a little cartoony you might say, but it’s definitely fun to play with (any program that features real-time physics just fascinates me). I made a quick demo to show you how it’s done.
I took a look at some reviews to choose the physics engine I would use and APE seemed to be the easiest one. It was pretty simple indeed as I was able to build my original demo in a single day.
It was a little tricky to create the physics bottle that would hold the particles. The easiest way I found was to put movieclips on stage in the shape of the bottle and loop through each pieces and create a corresponding APE RectangleParticule. The tricky part is that when you rotate a movieclip in Flash, the height and width of the clip changes, so i had to nest a movieclip within to be able to read the correct height and width of the particle.
That’s pretty damn cool patrick. RealFlow, for Flash.
Hey dude, you get to do the first comment ever on my new blog 🙂
Patrick, very very cool!
Did I win a Manhattan on the rocks? YES!
Nice!
Excellent ! nostalgie de la prog … beau résultat… en ligne bientôt?
C’est pas en ligne, c’etait trop cartoon, on a du faire autre chose, tu peux voir le preloader final sur http://www.gatorade.com.
Pretty cool and smart project. congratulations
Wonderful, so nice.
This is absolutely amazing. Congratulations on the great work.
Holy Moly!
this is genious!
I would have never thought it was so simple to generate the look of fluids…
have you tested to check if the process is heavy on crappy computers?
nice engine, i’ll try to pimp my ride
Appreciate for the lovely information.:)
This is just perfect!.. Simple and functional.
WOW…. guy… the simplest but perfect idea… wow… just… wow… this is so complete… wonderful idea…
AMAZING! NICE 😀
Hi Patrick,
Just had a look at the code. It works really well fair play.
I’m just wondering if you know of a way to change the direction of the gravity?
I’d like to be able to change the angle as I use the application…
Thanks
Hi JC, I’m not sure, you could check APE’s documentation, there might be a vector somewhere that you can set for the gravity.
Do you know of anyone that has tried to implement something similar to your liquid demo in Sprite Kit using SWIFT?
I am just getting started as a developer and I would love to figure out how to do this. One part in particular I don’t know what to do with is this:
“apply threshold on bitmapdata to get hard edges”
I have tried to Google how that would be done in Sprite Kit but have not been able to find any answers.