This project has moved and is read-only. For the latest updates, please go here.

Creating physics geometry from Path

Topics: Developer Forum
Aug 30, 2010 at 10:41 PM

I'm using Expression Blend 4 and I'm drawing the 'landscape' of my simulation with a Path. Has anyone written a util to walk a path and extract vertices from it in a way that looks decent in Farseer? The Path can contain curves and such so it would need to be clamped to a finite set of segments of course. For example, I'd like to have some rolling 2D hills and throw that Path object into the physics engine and have nice approximated physics geometry to collide with.

Walking the Path segments and approximating the Bezier curves and such seems pretty straight forward but if this code is already done I'd rather not re-invent. This feels like something folks would bump up against quite a bit using Farseer and Paths. 



Aug 31, 2010 at 2:36 PM

I haven't, but I'd be very interested in the code if you do end up implementing this yourself. 

Aug 31, 2010 at 5:16 PM

There is code in this project that can convert a path to points.

Another trick you need is getting progromatic access to the paths you create  in Blend.  They do not automatically come accross.  You have to add a single point animation to the path. This will force blend to use the full XAML syntax for the path rather than the mini-lanugage.  This will also, then allow you to access the path progromatically.


-Jeff  Weber



Aug 31, 2010 at 5:26 PM

This is *perfect*. I just ran into these issues with the mini-language last night and had some annoying hacks to work around it. Thanks so much Jeff! 

I may wrap this up into something that can just be created with the FixtureFactory class, along the lines of "FixtureFactory.CreateEdgesFromPath(path, tolerance, etc. etc)". If I get something reasonable I'l share the results here.


Thanks again! 


Aug 31, 2010 at 8:22 PM

Adding this as a helper class would be great.