Robot Foot Games Helping you improve your games as we improve our own. :)


Farseer Physics Platformer 3.3.1 Update

It sucks when updates to a project break existing tutorials out there, so I'm posting the 3.3.1 update to @RoyTries XNA Farseer Platform Physics Tutorial (website is now dead so the link is using the way back machine to bring up the old post. Any pictures/files will be broken though) that he wrote. @RabidLionGames updated it when the 3.2 update came out and a few things got broken in the 3.3.1 update so hopefully this helps out anyone who's looking for a working version in 3.3.1!

This post is just going to show the breaking changes from 3.2 to 3.3.1. Make sure you complete the original tutorial to get the project setup and read the 3.2 update to see the changes made in that version. Make sure to read the part about the unit conversion from 2.1.3 to 3.2 otherwise you'll have massively huge objects on your screen! After those 2 are done and set up there's a handful of changes below that you can make below to have a working version with 3.3.1.


Changes from 3.2 to 3.3.1:


Find the following variable and remove it altogether:


Here is what the 3.2 version of our SetupPhysics method looked like:

In 3.3.1 we have a BodyFactory that will create a Body and attach a Fixture to it so we don't have a need for the explicit 'fixture' object that was declared at the top (that's why we removed it!). Your new SetupPhysics method should now look like the following:


In StaticPhysicsObject.cs find the following line:

and replace it with this (once again, 'fixture' is gone so we update it):


In CompositePhysicsObject.cs the following:

Gets changed to:

Once again, we simply removed anything that referred to the 'fixture' object since we're not using it.


In SpringPhysicsObject.cs find the following line:

and replace it with this (guess what... no 'fixture' object so we cut it out!):


Character.cs remains the same as the 3.2 version.

Now for the bread and butter, CompositeCharacter.cs. Change:



Inside of the SetupPhysics method you can remove these two lines:

and replace them with this line:


a little further down in the SetupPhysics method you'll find these lines:

and you can change them to this (using the BodyFactory to create the Body and attach a Fixture. Since wheel is a Body instead of a Fixture now, we remove the extra ".Body" found in the bottom two lines):


The last change near the bottom of the SetupPhysics method is to update these two lines since we're not using the fixture variable anymore:



You can download a ZIP file of all of these updated classes here to check for differences if something didn't work.

Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

No trackbacks yet.