Status of the WPF code?

Mar 24, 2010 at 1:51 PM
All, I am curious to know who is having any real success with the WPF version of these utilities? I can't seem to do anything practical with it, as it crashes left and right. Simple models that I hook up seem to fail. I even took the ragdoll control, compiled it in a WPF app, and it crashed on startup. Am I doing something wrong? Or is the WPF side of things immature at this point? Thanks, Brian
Mar 24, 2010 at 2:06 PM

I can tell you that the WPF version doesn't get as much attention as the Silverlight version. I haven't had the occasion to port all of the demo's over to WPF and shake out the bugs.

What kind of errors are you seeing when it crashes? Are they boundary detection problems?

Mar 24, 2010 at 2:28 PM
Yes, they tend to be "Could not determine the outline of UIElement foobar. Could not find a point within its boundaries.". Sometimes they are errors about "The UIElement foobar s too small to determine outline (must be at least 3x3 pixels)". In either case, it seems related to boundary conditions. I'd be happy to look into it further... it will take me some time to get into the code. Any thoughts to what is going on? Brian
Mar 24, 2010 at 2:36 PM

Yeah, for what its worth, this is the most common error in both Silverlight + WPF versions.

There is an algorithm in BoundaryHelper.cs that determines the outline of an object by "tracing" its path. This path is then used as the shape (Geometry) of the PhysicsObject.

But the algorithm is picky. Here are a few tips:

- make sure that the Width and Height attributes for the element completely cover its contents. That's what the algorithm uses as the bounds of the boundary detection.

- if you are using PNG images, make sure that they have a "clean" outline and there are no stray pixels around their border. I wouldn't use JPG at all because they can be too pixelated.

- Keep everything in a Canvas and stay away from Grid layouts. Keep the Canvas at position 0,0 in your layout.

Hope this helps.