Box2D physics and Papervision

In the past I have experimented with the use of the ape physics engine and papervision3d together with some interesting results. Box2D is another physics engine available for flash, so I thought I would do a small test to see how that integration worked. As a whole I would say that ape physics is a fair bit easier to use, but Box2D is a lot more powerful. Here is a quick experiment with it.

I also noticed a small papervision bug in this example. As you can see there is a weird glitch at times. It is occurring whenever I add a new 3D object into the scene. I can’t seem to track down what exactly is causing this. Update: On further examination this bug was not a papervision bug, but rather a mistake in how I was reading the display list from Box2D. It’s display list adds items onto the beginning rather than the end, causing the error to occur.

Also notice the nice shading on the cubes, that is the power of papervision3D 2.0.

Grab the source code here


Comment functionality has been disabled. Contact me on Twitter.

Martin said:

Hey Tiler,

Really nice work there!

Just loved your work!

Could you give us the source code of this example?


Tyler Egeto said:

Thank you, source code to come later today.

Betty said:

Works from home now! Very nice!

Tyler Egeto said:

The source code is up at the bottom of the post.

Omni said:

Hi Tyler, Nice work however in the source files you make a reference to phyGround( ) and phyBox( ); but i cant seem to find these class in the download for box2D so i cant get your source files to work Any ideas why?

Tyler Egeto said:

Those are both MovieClips in the .fla’s libary and not part of the box 2D download. I double checked the download files and they are in there. Take a look in there. If you take a look at the .swf that shows the 2D particles as well as the 3D you can see them there.

Omni said:

Hi Tyler, thanks for the reply, I was using flex to build the file so it took me a little while to work that out. Anyway i managed to get a small example running on my blog check it out.

gordee said:

Hi Tyler,

great work here and thanks for sharing.

Are the PhysGround and PhysBox movieClips empty clips?

Tyler Egeto said:

Thanks gordee,

Yes I believe they are, (it’s been a while). I should mention that this is from version 1 of Box2D, which is now on version 2.1, so some of the code will be out of date, however the concept is the same.

Brett Forsyth has a great collection of tutorials for 2.0 and up on his site here: The

sf said:


using your approach I’ve created 3D “dice roller”: I’m using two 2D worlds – one simulating x axis, the other y axis. Of course, the physics isn’t 100% correct but I’d say the overall feeling is quite ok.

Tyler Egeto said:

Hey, that looks nice, good one!


Browse All >