I’ve created a small XBAP 3D physics demo for pure geeky delight.  It’s got a long way to go, but it’s got a nice button that lets you drop beachballs on to each other, so I think that makes it morally OK smile_wink

It’s built on a managed version of the Bullet Physics Library, tweaked slightly for WPF (so it’ll run locally as an XBAP).  Give it a try and see what you think.  Some general notes:

  • Performance is fair; it could struggle on slow machines.  There are loads of optimizations we can do with WPF 3D (merging models into one GeometryModel3D can give huge improvements) but I’ll save that for another post smile_shades
  • Dropping too many objects will bring any system to its knees pretty quickly.  It’s not culling anything to a view frustum yet and the sphere models probably have too many vertices, so even if objects roll off screen they’ll still suck your CPU dry.  Just don’t do it smile_regular
  • You’ll get better performance with spheres than boxes.  They generally come to a rest more decisively (the physics engine marks objects as inactive when they’re at rest, at least until something hits them).  Boxes can currently ‘jitter’ a while before they settle down.

I’ve published the source on CodePlex.  Let me know if you’d be interested in contributing!

UPDATE: Did a couple of rendering tweaks and enabled camera movements (drag mouse to move, right-drag to zoom).  Also, thanks for the great feedback!

UPDATE 2: Fixed earlier ‘rolling’ issue (my bad) and added a ‘drop box’ button.  Boxes don’t behave quite as nicely as the beachballs yet (they act like jello cubes) but they’re still a lot of fun smile_party

About these ads