07.14
I’ve been experimenting with the physics engines that are available for ActionScript 3.0 for an upcoming project. The project has elements of 3D, so at first I was only looking at the engines that had been ported to use some sort of 3d engine like Papervision, or my personal favorite, Away3D. Falling into this category would be only two that I know of–WOW Physics Engine and JigLib for Flash. Both of these engines are very sparse as far as tutorials or getting started guides, or even documentation for that matter. This is expected, as both are in early alpha or beta versions, and have a long way to go before they can be considered stable for production use.
Then I found Box2D for Flash, which is a port of the same library for C++. Although it doesn’t have native support for 3D, it does have the best collision detection of the bunch, as well as the fastest response times (which I’m sure has a lot to do with the fact that it’s only calculating 2d transformations).
So here is my first example of what combining the Away3d library with the Box2d library. This demo itself is a port from the same example made by Billy Lamberta here, except for the fact that he used Papervision and I used Away3d.
You can pick up and throw the blocks with your mouse, and they will collide with the “walls” of the swf as well as the other blocks.
Edit: You can download the source code here. This is meant to compile in Flex Builder, but should work in the Flash IDE if you add the Base.as class as the Document Class in a new .fla.

No Comment.
Add Your Comment