This project has moved and is read-only. For the latest updates, please go here.

both query on FP2.0 and FP 3.0

Topics: Developer Forum, Project Management Forum, User Forum
Oct 3, 2010 at 1:31 PM

Hello, everybody.

I am developing a bit game program using both of FP2.0 and FP 3.0.

The reason I use FP 2.0 is that I am familiar with it.

And the reason I use 3.0 is that genBox have said that it is better 2.0.

But I have both of problems of them.

in case using the FP 2.0, the impules effects doesn't work well.

For example, if I apply impulse to some body for flying it using "ApplyImpulse", the body doesn't work sometimes. The body is flying in wrong direction and wrong strong.

how can I do?

And in case using the FP 3.0, Every body is moving very slow.

how can I do for moving of everybody like real world?

Oct 3, 2010 at 1:42 PM

It is easier to use one engine at the time. I suggest you try out 3.0 and see if you can become familiar with it. If it turns out it is too complex for your game or simply too difficult to work with, then you can always go back to 2.x.

I'm not sure how you implemented the engines, so I can't give a good guess on why ApplyImpulse does not work for you in FPE 2.x. However, the reason they are moving really slow in 3.0 is that we no longer use pixels as the unit, but meters.

To learn about the meter system, you can take a look at section 1.7 in the Box2d manual and the API/Engine units in the Box2d FAQ.

Oct 3, 2010 at 2:03 PM

Thank you ,

here is my code.

Body body = BodyFactory.Instance.CreateCircleBody((int)(size.X / 2 * 0.3f * CmnRsc.screenScale), 20);

Geom geom = GeomFactory.Instance.CreateCircleGeom(body,(int)(size.X / 2 * 0.15f * CmnRsc.screenScale), 50);

geom.RestitutionCoefficient = 0.1f;

geom.FrictionCoefficient = 5.0f;

body.ApplyImpulse(new FarMaths.Vector2( 10000 * CmnRsc.screenScale, 10000 * CmnRsc.screenScale));

And What's wrong with it?

Oct 3, 2010 at 2:12 PM

And could you give me some sample for unit in FP 3.0?

Oct 3, 2010 at 2:15 PM

if I understand about unit in FP3.0 well, I am gonna to use it.

Please help me . . .

Oct 3, 2010 at 2:40 PM

I can refer you to the samples. The DebugViewXNA class uses a matrix to convert between screen and physics space.

Oct 3, 2010 at 4:27 PM


Thank you

Oct 4, 2010 at 1:56 AM

Hi, genbox.

How is going your business and how are you doing today?

I need your help again.

I have used the debugVew as you told me.

But I can not feel the difference between pixel and meter.

of course, I don't mean I  don't know the pixel and meter. I don't understand the releation of them.

and in the debugvew , every body moves down in case the gravity is negative.

But in my proj, in this case, every body moves up.

What's wrong?

Oct 4, 2010 at 3:52 AM

How are you doing, genBox?

I have just seen the reason  of working wrong for impluse.

The reason is that the body's acceleration increases automatically.

But I don't know why the acceleration increase automatically.

Can you help me?

Oct 4, 2010 at 3:56 AM

HeHe, I myself have fixed all problems in FP2.x.

And I need only to fix some problems in FP3.x.

help me please . . .

Oct 4, 2010 at 8:08 AM

The Coordinate system for FP3 has changed from FP2.x. The Y axis now increases towards the top, instead of the bottom as in FP2. That's why the gravity seems to be the inverse now (as if you want to make the objects fall down, you have to set the gravity a negative value for the Y).

You have to set the relation between pixels and metters. It's kind of hard to understand but there are a couple of threads in this same forum that should help you. This thread for example.

Oct 4, 2010 at 8:13 AM
Thank you for your kind response.
But you need to read my query exactly.
I mean everybody moves up in case setting the Y gravity in negative value.
What's wrong?
Oct 4, 2010 at 9:50 AM

You said:

and in the debugvew , every body moves down in case the gravity is negative.

But in my proj, in this case, every body moves up.

This is because the coordinate system un FP3 uses a positive value for the Y axis pointing up (as opposite of the spritebatch's coordinate system which is negative when moving up). You may need to convert the coordinates from world coordinates (as FP3 sees them) to screen coordinates (spritebatch's) before drawing.

Oct 4, 2010 at 9:54 AM
Ok, I understand.
I am going to do it now.

Oct 4, 2010 at 10:43 AM

I have fixed my current all problems.

And Thank you to those who have supported me . . .

Happy life to everybody~