FOAM Rigid Body Physics Engine Alpha Release 0.1

I’ve been working on FOAM off and on in my spare time for the past few months. Recently I’ve been working on solving constraints on a global level- which is no easy task. I decided to work laterally for a bit and get a release out.
FOAM is primarily intended as a resource for developers interested in simulating physics. It has a carefully thought out OOP structure and modular design. A savvy developer should have no problem extending and repurposing FOAM to his own ends. The Foam datatype is in fact not a physics engine but an interface for simulating physics. It offers a simple means to create, control and run a simulation- it purposefully keeps the more nitty gritty, behind-the-scenes operations shielded from the casual developer. A physics engine is simply part of its composition.
I think the best way to use FOAM as a resource for creating physics simulations is to look through the source. I did a decent job commenting and use fairly descriptive variable names. When I set out working on simulating rigid body physics, I didn’t find one comprehensive resource- an article would be helpful here, a tutorial there, but then the matching source would be a comment-less single-letter-variable mess. Also- not coming from a mathematical background, the often obtuse-sounding descriptions in articles can be daunting. In practice, seemingly complex equations can translate to very simple algorithms in the world of computers. I hope that FOAM bridges some of these gaps.
Over the next few weeks, I’ll be posting tutorials and examples- Please let me know of anything that interests or confuses you and what you think in general!
simple demos included in source:
Looks awesome, i’ve been checking here for weeks now waiting for this release, can’t wait to try it out! Great work!
Hey Drew - the demos look great… congratulations!
Looking forward to seeing more.
very cool!
nice foam logo too.
too.. many… toys.. must play. I know what will take the next few days of downtime or when I should be working time. Source looks great can’t wait to give it a spin. Thanks!
Wow! Very cool engine! I wish somebody wrote 3D one. ) Papervision 3D need good physics! ))))
Excellent news !
The capabilities of FOAM seems to be excellent.
I’d be interessted to know if the engine handles correctly fast particle, and more generally how collision detection is managed. But I guess I should look at sources first
Also, do you plan to create a development team around this project?
Best,
Thomas
Thanks everyone for the positive feedback!
@Ryan–>
I hope it doesn’t steal your time from anything too important!
@Dan–>
I’m fairly certain someone had started a 3D physics engine… it was called WOW if I remember correctly.
@Thomas–>
Thanks! It does not handle fast movement at all right now- just static collision checks at set intervals. The collision detection/response is currently in a “get-it-done” phase… It will receive a complete overhaul as I move interactions over to a constraint-based model. That said, it should maintain its current form despite that.
As far as a development team, I’d love for one to come out of this- I think that that’s unlikely however until contstraints are implemented how I’d like.
I’ve always admired your work with Sandy- thanks for the kind words!
Thanks drew for your answer.
In case you want some help, I’d be interessted to join such project. I’ll study the sources and play with the current API while you get enough satisfied to make it grow with community help.
About WOW the engine is still in development. His author is still waiting a feature to be finished before any release.
Otherwise, some 3D physic experiments has been done with Sandy if you are interessted :
http://www.flashsandy.org/forum/viewtopic.php?f=10&t=135
and
http://www.flashsandy.org/forum/viewtopic.php?f=10&t=167&start=10
Hope you don’t mind I share these links.
Great work man, from what I have seen so far this looks really nice. I’m anxious to hear more about it in our code review tomorrow!
Thanks, Ryan!
@Thomas–>
Thanks for the links! I’d definitely love your help. I’ll be in touch…
Cheers,
Drew
Hey dude, make sure you set wmode=opaque for your demo embed tags otherwise in FF they’ll only run at ~half speed
Hello,
may u give us an example of use with flash CS3 ?
thanks
hey there i try to use your engine but i’m meeting some baaaad points which i wanted u to explain to me because i’m like a noobie u know…
I wanted to know how would u do to add some graphic stuff to polygon without making the computer damn slow. I tried to add a dropshadow filter (for fun) in the drawpolygon function (which is simplefoamrenderer). It works great but it becomes slower and slower and slower… i tried to put some Loaders into polygon too, but it looks like uh… kinda stopped
i got maybe 1fps, 2 ?
please answer me u got my mail. I’d be glad to help you
kny- see this post: http://blog.generalrelativity.org/?p=21
I played around with PerpetualFall a little bit and it’s very neat. However, it seems that if you use foam.removeElement(simulatable) when the bodies have fallen down instead of respawning them at the top, it also stops simulating the ramp and walls. Is that normal, is there something I’m doing wrong?
Hi Melissa,
Make sure you’ve gotten the more recent of the 2 builds from googlecode. The first release had a number of bugs just like what you’re experiencing. If you’re still having issues, shoot me an email and we’ll work through it.
OK, sorry for this post. I’m an admitted newbie to the flash development environment… I’m trying to compile/run your examples, but can’t get them to go. Can you lend any advice or point me to a resource? Should I be trying to embed these in a fla?
Thanks.
John
Hi. When we’ll see beta-release?
This is the first physics engine that I’ve been able to understand and modify without any physics knowledge at all.
It’s very well put together and readable!
Thanks!
Where are you Drew?!
Like erno b above said, this is the first physics engine that I’ve come across that I actually have a clue as to what is happening and am able to work with. I am a complete newb when it comes to OOP but was able to get the script working and am able to modify the examples to a certain extent. I need help with assigning a click action to each shape that is in the body as well as filling the shapes with a bitmap. Can anyone help? This is for Flash CS3. The effect I am trying to achieve is when a user mouse overs a shape, that shape expands pushing all others close to out outwards away from that shape.
Great work, this is very well done. The math is over my head. But, the library seems pretty easy to use.
I had to do a massive find and replace to change Vector to VectorPoint, since Vector has become a core class in CS4.
@John
Are you using flash 10? If so (like with a lot of physics engines) there is a Vector class conflict. To fix quickly I di Find and Replace in Files from FlashDevlop and replaced ” Vector” (space important) with ” org.generalrelativity.foam.math.Vector” (space again is important). Then “:Vector” with “:org.generalrelativity.foam.math.Vector” Then when you compile you’ll get warnings about the Vector class, change the public class and public function names back to Vetor. Think that was it, if not follow the compile errors…
I like the simplicity of this engine
I’ve been trying for a long time to get some realistic rectangles colliding and rotating… Now just need to sort out the wobbly jitteryness!
Thank you!!! =^_^=
I’ve been searching for a long time for simple and fast physics engine!