Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to build a simple side scroller with an airplane being the player. As such, I want to build simple flight controls with simple but realistic-feeling physics. I'm making use of cocos2D and Box2D. I have a basic system working, but just can't get the physics feeling correct.

I am applying force to the plane (which is a b2CircleShape) based on the user's input. So, basically, if the user pushes up, body_->ApplyForce(b2Vec2(10,30), body_->GetPosition()) is called. Similarly, for down -30 is used.

This works and the plane flys along with up/down causing it to dive or climb. But it just doesn't feel right. There is no slowdown on climbs, nor speed up during dives. My simple solution is far to simple.

How can I get a better feel for a plane climbing/diving?

Thanks!

share|improve this question
    
This link iforce2d.net/b2dtut/sticky-projectiles had some interesting ideas on air friction etc. –  Grimshaw Jun 19 '12 at 0:59
    
This reminds me of a question about simulating paper fluttering... could be overkill for what you're doing, but fyi box2d.org/forum/viewtopic.php?f=6&t=7718&p=33405 –  iforce2d Jun 19 '12 at 13:38
    
You also need to consider the transfer of vertical momentum to horizontal momentum when the plane "swoops". Of course this would not apply if your flying a brick. –  Derek 2 days ago

2 Answers 2

up vote 2 down vote accepted

Iterative empirical testing. Add some test sliders to your GUI that control the force applied for the upward and downward directions.

Other than that, consider changing the way force is applied. Add gravity into the mix, when the plane is horizontal its lift offsets gravity. The lift decreases with change in pitch. Your force is always forward, when pointing down it's in addition to gravity, when you're pointing up gravity is subtracted from the force.

Basically, think about how to make it more realistic if you want it to feel more realistic.

share|improve this answer
1  
In other words "stop being lazy and do it right, it's not terribly hard". I knew this was going to be the answer, but sometimes being lazy pays off. I'll start playing. :) –  MarkPowell Jun 18 '12 at 21:46
    
I suppose that sums it up :) Maybe it's not the answer, but it's an answer. Hopefully you get something more useful. –  Byte56 Jun 18 '12 at 22:45

Tilt the nose when up/down forces are applied, and cause the plane to rise or fall more the farther the nose tilts. So the longer you hold the key, the faster the plane rises or falls. Cap it, though, to avoid nosedives.

This should be a tradeoff with airspeed, with forward airspeed decreasing as the plane's nose moves away from a horizontal position. You may want to apply this only to upwards turns so that going down doesn't increase your airspeed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.