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:
sim/flightmodel2/wing/dataref_name[N]
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.
Good:
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.









