This topic is confusing, so I’m going to try to summarize “how to do it the correct way” without going into “under the hood”, first.

DataRefs of the form:


give you information about the wings – in particular, they tell you the degrees of deflection of the flaps, elevators, etc. etc.

But what number do you use for N?

The answer is: you pick “N” depending on which airfoil you are animating!

In X-Plane, the horizontal and vertical stabilizers are “wings” too – we call anything that has an airfoil a wing.  So you use this table to pick an N that matches what you are doing.


sim/flightmodel2/wing/aileron1_deg[0] # left aileron
sim/flightmodel2/wing/aileron1_deg[1] # right aileron
sim/flightmodel2/wing/elevator1_deg[8] # left elevator
sim/flightmodel2/wing/elevator1_deg[9] # right elevator
sim/flightmodel2/wing/rudder1_deg[10] # rudder

Usually not good:

sim/flightmodel2/wing/aileron1_deg[8] # aileron on an hstab??
sim/flightmodel2/wing/aileron1_deg[10] # aileron on a rudder?!
sim/flightmodel2/wing/elevator1_deg[0] # elevator on a wing?
sim/flightmodel2/wing/elevator1_deg[10] # elevator on a rudder?
sim/flightmodel2/wing/rudder1_deg[0] # rudder on a wing??

The moral of the story is: pick an array index that matches the part of the plane you are trying to animate!

Unusual Airplanes

I said “usually not good” above because there are airplanes with rudders on the wings (think of a flying wing) or V-tails where the tail is half-rudder, half-elevator.  The rule still applies: use the index that you are animating!  So if you have a rudder on your wing, then use index 0 (left wing 1) for the left wing, etc.  The important thing is to pick an array index that matches the Plane-Maker part.

Why Is It Like This?

If you understand what was written above, you should probably stop reading now. And if you didn’t understand it, you should probably stop reading now.

Okay then.  Why are the datarefs like this?  The answer is that X-Plane is a completely flexible simulator: it lets you put any control surface on any flying surface.  If you want to make an experimental design with elevators on the wings, X-Plane is not going to tell you that your idea is stupid.  (I might tell you that the idea is stupid, but you can ignore me, because the only airplane I ever designed from scratch in Plane-Maker couldn’t take off without JATOs.)

In particular, because any flying surface can have any control surface, the datarefs are set up with array indices for all flying surfaces for all control surfaces.

But if your airplane does not have rudders on the wings, the value of those daterfs won’t be useful – they might be ‘correct’, they might be zero, they might be wrong.  Don’t trust them!  Use the correct array index for the correct wing and your plane will work correctly.

About Ben Supnik

Ben is a software engineer who works on X-Plane; he spends most of his days drinking coffee and swearing at the computer -- sometimes at the same time.

6 comments on “Using the Correct Wing Datarefs

  1. I have this cheat sheet in front of me when working on the wings to help me remember what index to use.
    1L = 0
    1R = 1
    2L = 2
    2R = 3
    3L = 4
    3R = 5
    4L = 6
    4R = 7
    Hstab L = 8
    Hstab R = 9
    Rud 1 = 10
    Rud 2 = 11

    And so on for the misc wings. But those are the important ones. It can be confusing at first, but after the first go its simple. Just remember what wing you are working with.

    I love what you can do once you override the flight controls.

    1. Right – and that is why this system exists…because you can dial in some fairly complex specific control surface deflections (up to 8 differetn deflections for spoilers on a full 4-part wing, for example) and get correct graphics and physics.

  2. Using a plugin is the only way to do spoilerons properly because PM can’t do them. Anyway, it occurred to me that there was a way to improve the UI of this system in PM but I can no longer remember what that idea was.

  3. Humm, while I am thinking about it, is there any chance we can get the same system for the nose wheel steering? They are hydraulic too, and right now as far as i know, the only way to change how it deflects is to change the steering angle limits. It would be great for us to be able to have a bit more control over that same as we have with the wing elements.
    Or perhaps we can already do this but I’m looking in the wrong place? I haven’t messed with it since last Fall some time.

  4. Ben; slightly off topic, but I was wondering if using DDS files instead of PNG for cloud textures would help reduce the memory footprint or help in terms of performance?

    It’s just I noticed that the cloud textures are PNG.

    Sorry to drift off the main topic.


Comments are closed.