Porting from 2.3 and need some help

Topics: Developer Forum, User Forum
Aug 4, 2011 at 9:04 PM
Edited Aug 4, 2011 at 9:19 PM

Hello.  I have a game in XNA I am porting from 2.3 to 3.3.  I have already changed all the syntax.  I noticed that the world seemed to be running slow.  I did a little research and found out that everything is now in meters.  I found a good tutorial about it at http://blog.dreasgrech.com/2011/02/farseer-physics-engines-meter-kilogram.html and understand what I need to do.  I just have some questions for this.  

  • What was the scale in 2.3? 
  • What units does 2.3 use?
  • Will I have to change the scale that everything else is drawn that is not a body?
  • When I set up a joint do the anchor points need to be converted as well?

There is also other questions I had regarding Mass.  I noticed in 2.3 when you set up a body you would pass the mass in the constructor.  Now in 3.3 it is set up so that it takes density instead.  I am still passing the constants I had set up for the mass in 2.3 and am now passing them as density.

  • Will this set up the mass the same way it was before?
  • Can I set the mass manually?
  • Is the mass units the same in 2.3 and 3.3?

The reason I am asking these questions regarding mass is because when I apply forces just like I was in 2.3 the body seems to barely move like it is really heavy.  I know this probably has to do with the scale as well but the mass seems to be another issue coming up.  

 

  A couple more question about forces and I'm done.  

  • Do forces work the same in 2.3 and 3.3?
  • Do I need to convert the force numbers as well?      
Aug 5, 2011 at 12:36 AM

Has anyone tried just changing the engine to convert everything for you?  I have a lot of stuff to change over and it seems it would be much easier to just adjust the engine

Aug 5, 2011 at 7:04 PM

Hello?

Aug 5, 2011 at 11:21 PM
Edited Aug 5, 2011 at 11:27 PM
  • What was the scale in 2.3? 

Things were set in pixels, so if you make: box(100, 100) ir would be 100x100 pixels, now it will be 100x100 meters! so even with a veeeeeery big screen that's too much. Why it looks the same is because you viewpoint is also bigger, so everything looks the same, but does not react the same.

  • What units does 2.3 use?

2.3: i dont't know, Pixels, seconds

3.3: Kilograms, meters, seconds.

  • Will I have to change the scale that everything else is drawn that is not a body?

You can use ConvertUnits.ToSimulationUnits to conver from pixels (2.3) to meters (3.3), and ConvertUnits.ToDisplayUnits to do backwards.

  • When I set up a joint do the anchor points need to be converted as well?

I think so.

 

  • Will this set up the mass the same way it was before?

The mass now is in Kilograms, i don't know in which units was it in 2.3.

  • Can I set the mass manually?

I alwais use density, which is kilograms/m^3, but I think you can set mass too.

  • Is the mass units the same in 2.3 and 3.3? 

I don't know.

  • Do forces work the same in 2.3 and 3.3?

Yes, I think the both are set in Newtons.

  • Do I need to convert the force numbers as well?   

If the previous answer is right you should not. Changing the size of the bodies (Pixels -> meters) should make them act like before.

 

Hope this helps you at last a bit.

Disclaimer: I've never used FPE less than 3.3

Aug 8, 2011 at 8:28 PM

Ya that helps a bit.  But I need more info about what 2.3 was using.  I know about 3.3.