# 2d physics model - orthogonal or vector?

7 replies to this topic

### #1goodtobeking

New Member

• Members
• 3 posts

Posted 14 August 2009 - 09:21 AM

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?

### #2monjardin

Senior Member

• Members
• 1033 posts

Posted 14 August 2009 - 09:31 PM

Could you make the question a bit more specific? What exactly are you doing?
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

### #3goodtobeking

New Member

• Members
• 3 posts

Posted 15 August 2009 - 10:37 AM

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?

### #4flux00

Valued Member

• Members
• 108 posts

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.

### #5roel

Senior Member

• Members
• 698 posts

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?

DevMaster Staff

• Moderators
• 1716 posts

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:

Also, you can try emailing them too.

### #7monjardin

Senior Member

• Members
• 1033 posts

Posted 18 August 2009 - 08:53 PM

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".
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

### #8goodtobeking

New Member

• Members
• 3 posts

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