Search code examples
box2dfarseer

How to represent terrain as physics objects in Box2D/Farseer


What's the best way to represent generated 2D terrain in Box2D/Farseer? The terrain consists of some hills - think of some dunes.

There is a method to generate polygons from a texture described in the Farseer documentation: http://farseerphysics.codeplex.com/documentation (Section "Texture to polygon")

But actually I don't need the terrain as polygon. I only need the surface-line. Representing the terrain via polynomials would be great but I couldn't find any support for polynomials in Box2D/Farseer.

Do I have to work with Edges and LineArcs to model my dunes, or is there anything that would fit better?


Solution

  • Emanuele Feronato provides a tutorial for exactly what I was looking for on his blog:

    Create a terrain like the one in Tiny Wings with Flash and Box2D