Nov 282013
 

In article 13, we made our first steps with Farseer Physics Engine (FPE).
We had create a world and 2 objects (a floor and boxes going thru gravity).

This time, lets create a body from a texture (no more a simple shape like a rectanle).
Lets also add he ability to move that body around with our mouse by using a mouse joint.

Have a look at the method CreateFromTexture in the DrawablePhysicObject class : in short, it creates a polygon from a texture.
Have a look at the update method where we use a FixedMouseJoint.
Also, see how easy it is to add extra objects like 2 extra floors.

Side note, finding documentation on FPE can sometimes be tedious, especially on latest 3.5 version where significant changes were introduced.
Still, here is a good start (although meant for 3.3).
Also, the box2d manual is usefull to understand concepts.
And to close this parenthesis around documentation, the farseer samples are very instructive as well.

Look at the video below to illustrate all this : body from texture, mouse joint.

 Posted by at 22 h 34 min

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.