Well, progress this weekend was hampered somewhat due to the fact that it took me a lot longer than I thought to get an understanding of how Farseer works. There is a very good tutorial on getting started with Farseer on Sgt. Conker, but unfortunately it was made for Farseer 2.1.3, and the latest version is 3.1.
On the face of it that shouldn't be a challenge, but alas, I'm finding more and more often in the world of game development that things are rarely as simple as they seem.
The biggest issue with applying the 2.1.3 tutorial to 3.0 is the units system. 2.1.3 uses screenspace pixel units, whereas 3.0 (based on Box2D) uses what it calls 'MKS' or meters, kilograms, seconds. This has the unfortunate side effect that a falling block of 50x50 pixels has the physics of a falling building if you just plug the pixel dimensions into the physics engine.
At first, after trying to convert the units manually, I thought this was a deal breaker, and decided to use 2.1.3 instead (when I discovered that it compiles directly under xna 4.0, but that's another story). However I was persuaded by Farseer's creator that 3.0 offered a number of benefits over 2.1.3, I decided to give it another try.
Then I came across the ConvertUnits helper class in one of the samples that ships with Farseer 3.0. This largely solved my unit problems, although I still had some issues with things like magnitudes of forces ir impulses.
So after a couple of hours of playing with the tutorial, including faking a anglular spring (which isn't included in 3.0) with a anglejoint, I finally got the tutorial working. Being the good community member that I am, I will be writing up my adventure later in the week and sending it off to Sgt. Conker as an update to the current tutorial.
Watch this space for a link! Then it'll be back to Alta for an abstraction layer around Farseer 3.0, which among other things, will attempt to convince the developer that they are working in pixel units!
No comments:
Post a Comment