2d physics model - orthogonal or vector?

Db26dc98bc8f66db754355fc5c1ba592
0
goodtobeking 101 Aug 14, 2009 at 09:21

I try to find a better way to handle physics in our 2d-flying game. My current solution is to use different maths:

For movement vectors - it’s simple to change speed and direction.
For gravity orthogonal - it’s simple to change y-location.

This works fine as you can see here http://isopuli.net/2009/index.php?id=0 (it’s Java applet) but the code is very hard to modify.

Any idea how to combine the best of both maths?

7 Replies

Please log in or register to post a reply.

6f0a333c785da81d479a0f58c2ccb203
0
monjardin 102 Aug 14, 2009 at 21:31

Could you make the question a bit more specific? What exactly are you doing?

Db26dc98bc8f66db754355fc5c1ba592
0
goodtobeking 101 Aug 15, 2009 at 10:37

Thanks for reply.

I have coded a 2d-flight model where plane is influenced by its inertia and forces: lift, drag, steering (left-right), thrust, wind, gravity, kinetics. I did not succeed to implement this model as a simple algorithm so I just add one force at time.

Now I would like to add turbulence etc., but it is a bit too difficult to swap between different coordinate systems and also checking trigonometry discontinuity. Especially, as I have to teach AI pilots to fly and fight again each time I change the model.

Briefly: Any good ideas how to implement 2d-flying model?

F15213bd1bee350b83c3a2e5f9748b13
0
flux00 101 Aug 17, 2009 at 00:09

You have to define what you mean by “turbulence, etc”

You sound like you’re on the right track as far as updating the position, orientation, and velocity of the plane based on the various forces. Perhaps you need to consult a book on the mathematics of aviation if you want even more realism.

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Aug 17, 2009 at 08:54

Your game looks promising. But which coordinate systems do you have now? One for the world, and one relative per plane?

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Aug 17, 2009 at 21:10

Sometimes, it’s good to look for open projects and see how others have tackled it. For example, I remebered this one:
http://code.google.com/p/flyer2d/

Also, you can try emailing them too.

6f0a333c785da81d479a0f58c2ccb203
0
monjardin 102 Aug 18, 2009 at 20:53

I played the game and see what is going on, but I don’t understand exactly what you mean by “gravity orthogonal” versus “movement vectors”.

Db26dc98bc8f66db754355fc5c1ba592
0
goodtobeking 101 Aug 19, 2009 at 17:59

@roel

Your game looks promising. But which coordinate systems do you have now? One for the world, and one relative per plane?

That’s just great! I really should have done it that way: different models to forces of world, between objects and plane itself. And I bet it will be very interesting to combine all of these together. Sure!

That flyer2d is a good study of joint body2d kinetics, but it’s hard to see how you apply AI to such a theoretic (i.e. non-intuitive to me) model.