Simulating liquid with actionscript 3 and physics engine APE.

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.

Click to open SWF

Click to open SWF

I quickly looked at some reviews to make my choice on the physics engine i would use and APE seemed to be the simplest one. It was pretty simple indeed as i was able to put up 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.

Download the source

Tags: , , , , ,

18 Responses to “Simulating liquid with actionscript 3 and physics engine APE.”

  1. Adrian Luna says:

    That’s pretty damn cool patrick. RealFlow, for Flash.

  2. Hey dude, you get to do the first comment ever on my new blog :)

  3. Ivan says:

    Patrick, very very cool!

  4. Adrian Luna says:

    Did I win a Manhattan on the rocks? YES!

  5. Alice Bernier says:

    Nice!

  6. exogene says:

    Excellent ! nostalgie de la prog … beau résultat… en ligne bientôt?

  7. 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.

  8. @lasmovies says:

    Pretty cool and smart project. congratulations

  9. Leonardo Hessel says:

    Wonderful, so nice.

  10. [...] But yesterday (I thought would be another endless search for the answer) I found the final and just so simple solution. The only problem was that it was build with APE, but with the source provided it wasn’t that [...]

  11. Rich says:

    This is absolutely amazing. Congratulations on the great work.

  12. Lorenz says:

    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?

  13. car says:

    nice engine, i’ll try to pimp my ride

  14. Appreciate for the lovely information.:)

  15. Suad says:

    This is just perfect!.. Simple and functional.

  16. Péricles says:

    WOW…. guy… the simplest but perfect idea… wow… just… wow… this is so complete… wonderful idea…

  17. Patrik says:

    AMAZING! NICE :D

  18. [...] Acceder al Tutorial Ejemplo: Simulando un fluido con ActionSript Physics Engine – ENG [...]

Leave a Reply