You can get the source for my XBAP 2D Physics demo here.  It’s not as neat and tidy as I’d like but it’s still pretty good.  Right now it’s all in one project; the actual ‘DynamicsEngine’ is just in a subfolder.  I’ll shamefully admit that when I wrote it I had no idea XBAPs could deploy external assemblies too! (something I’ve since been exploiting).

The code is pretty much a straight port from Flade, an excellent Flash/Actionscript engine by Alec Cove.  Just be wary of the couple of small hacks I’ve added for particle/particle collision (it works, but I’m not certain my calcs are good).  Also, you might notice a wheel “on its own” doesn’t seem to accelerate when it rolls down a slope — but it’s on my todo list!

About these ads