• Create Account

## Modeling some flight physics.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1TheAsterite  Members

203
Like
0Likes
Like

Posted 16 May 2014 - 12:13 AM

So I'm just about getting started making a small, on rails flight game in Unity3D, and I have to model some physics that fit well with the control scheme I have. What I want to do is map the different analog triggers of a controller to each wing of a dragon, so the more you push the analog trigger down, the less lift you have on that wing so you lean and fall toward that side. It's been a while since I've taken physics, so I'll try to do my best to lay out how I've been thinking on how to solve this problem.

Since the game is going to be on rails for now, I'm just going to apply a constant force forwards to move the character.

So for stable flight, I obviously need all the vertical forces to sum up to zero. I'm guessing gravity will be my only force pushing downward. I'll have 2 forces pushing upward for each wing.

I'm having trouble figuring out how to map the horizontal and rotational forces of the character though. I want to eventually be able to make it easier or harder to maneuver based on wing extension. I also want to model how the angle of attack effects the forward speed of the character also. What would be the best way to do it? Are there any sources on flight I should read first before I tackle this?

### #2CombatWombat  Members

617
Like
1Likes
Like

Posted 16 May 2014 - 07:08 AM

I think you're having a hard time because you may not be clear what your end goal should look like.  A well described question is halfway answered.

You say it's on rails.  But then you want to account for angle of attack and wingspan while having a constant force driving you forwards.  You seem to be creating a hodgepodge of rails and physics based behavior.  I caution that such a hybrid may create strange edge-case behaviors and may tend to be unintuitive.

Let's break this down to the simplest forces you need to fly.  Airplane, dragon, whatever.

Lift, thrust, drag, gravity.

You can use simple lift coefficient for lift force.

Its sounds like you want thrust to be constant forward.

You can use simple drag coefficients to get a drag force.

Gravity is gravity.

For your rotional control you have 3 axis.

Pitch, roll, yaw.

Here is where you need to better define your control scheme.  Should the triggers roll you directly?  Should they be mapped to angle of attack of left and right wings?  Should they be mapped to give an aileron effect (left wing down, right wing up)?  How do you pitch?  You need a tail.  Ditto for yaw.

### #3Buckeye  GDNet+

10739
Like
1Likes
Like

Posted 16 May 2014 - 07:13 AM

I obviously need all the vertical forces to sum up to zero

If you want the dragon to rise and fall, you'll need unbalanced forces which do not sum to zero.

force = mass * acceleration, or

acceleration = force/mass

The vertical force will be < 0 when the wings aren't flapping and >0 when the wings are flapping.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

### #4TheAsterite  Members

203
Like
0Likes
Like

Posted 16 May 2014 - 11:10 AM

I think you're having a hard time because you may not be clear what your end goal should look like.  A well described question is halfway answered.

You say it's on rails.  But then you want to account for angle of attack and wingspan while having a constant force driving you forwards.  You seem to be creating a hodgepodge of rails and physics based behavior.  I caution that such a hybrid may create strange edge-case behaviors and may tend to be unintuitive.

I was imagining something along the lines of Star Fox or Panzer Dragoon, where even though it was on rails you could still move a little bit within the level. The Fluzzard levels from Mario Galaxy 2 is probably closer to what I'm looking for though.

Let's break this down to the simplest forces you need to fly.  Airplane, dragon, whatever.

Lift, thrust, drag, gravity.

You can use simple lift coefficient for lift force.

Its sounds like you want thrust to be constant forward.

You can use simple drag coefficients to get a drag force.

Gravity is gravity.

For your rotional control you have 3 axis.

Pitch, roll, yaw.

Here is where you need to better define your control scheme.  Should the triggers roll you directly?  Should they be mapped to angle of attack of left and right wings?  Should they be mapped to give an aileron effect (left wing down, right wing up)?  How do you pitch?  You need a tail.  Ditto for yaw.

Left analog stick will control pitch and horizontal movement. Whether to make it control yaw directly, I'll have to play around with it to see. And yes, I was thinking the triggers roll you directly as well as making you lose a little lift in the process.

Unity3D's engine already has variables built into it's physics system for drag and constant forward force, so that part is easy. I'm was using them to keep a constant forward velocity when I was playing around with the system.

Edited by TheAsterite, 16 May 2014 - 11:13 AM.

### #5LorenzoGatti  Members

4080
Like
0Likes
Like

Posted 20 May 2014 - 04:13 AM

I suggest focusing on a simple physical model and adding the "rails" behaviour on top of it as a control override, without hacking the physical model: if the dragon is about to exit the allowed range of position or attitude (which would be variable at different places in the level) you can steer towards the predefined path (or along the boundaries) rather than according to player input. If you figure out how the player can control the dragon effectively, the rules to steer it automatically should be trivial.

Regarding control schemes, I would map the "main" analog stick to pitch and yaw (usually in a neutral position to fly straight, or maybe to automatically follow the "rail") and the other to thrust and roll (usually in a dead forward position for maximum speed, or neutral to coast along at medium speed).

Associating controllers to wings defies intuition: a natural model of a flapping wing has at least three degrees of freedom (magnitude and direction of lift force, or more conveniently integrated over a flapping cycle to obtain an impulse) and the mapping down to one or two axes per wing isn't obvious.

Omae Wa Mou Shindeiru

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.