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?
2d physics model - orthogonal or vector?
Started by goodtobeking, Aug 14 2009 09:21 AM
7 replies to this topic
#1
Posted 14 August 2009 - 09:21 AM
#3
Posted 15 August 2009 - 10:37 AM
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?
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?
#4
Posted 17 August 2009 - 12:09 AM
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.
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.
#5
Posted 17 August 2009 - 08:54 AM
Your game looks promising. But which coordinate systems do you have now? One for the world, and one relative per plane?
#6
Posted 17 August 2009 - 09:10 PM
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.
http://code.google.com/p/flyer2d/
Also, you can try emailing them too.
#8
Posted 19 August 2009 - 05:59 PM
roel said:
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.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











