![flight simulator x airplanes flight simulator x airplanes](http://intensivekwik.weebly.com/uploads/1/2/4/2/124291011/522295647.jpg)
Quaternions are mathematical constructs that (among other things) can fully describe an arbitrary rotation in 3-dimensional space. The dataref q here is a quaternion, stored as an array of four floats. (Warning: datarefs are case sensitive lower case q here is the quaternion aircraft rotation, while Q is a rotational rate of the aircraft.) Every frame, the physics model updates q and then copies the values to psi, theta and phi. Is read and written by the physics model and is the master copy of the aircraft’s orientation when the physics model is in. The datarefsĪre read by the graphics engine to draw the aircraft. However when the physics model is on, things are a bit more complicated.
![flight simulator x airplanes flight simulator x airplanes](https://clothingsoftis618.weebly.com/uploads/1/2/4/7/124781449/969273875.jpg)
The aircraft’s orientation is described by three rotations, “psi” (heading), “theta” (pitch), and “phi” (roll). If you need to place the aircraft based on latitude/longitude information, use the function XPLMWorldToLocal to convert coordinates.Įxample: add 10 from sim/flightmodel/position/local_y the aircraft hops 10 meters up in the air and then continues. X-Plane will calculate the latitude/longitude and elevations (AGL and MSL) for you from the local cartesian coordinates. You can read or write these datarefs at any time. To place the user’s aircraft, you position it in local coordinates (see ScreenCoordinates). Do not continuously reposition the user’s aircraft with the physics engine running your positioning commands and the physics engine will thrash the aircraft around. While the physics engine is running, you may position the user’s aircraft it will instantly move and then continue in the direction it was flying (or the direction you specify). Positioning the User’s Aircraft While the Physics Engine is Running The routines XPLMWorldToLocal and XPLMLocalToWorld work in double precision on the latitude-longitude side. Because the local coordinate system moves to keep the aircraft near the origin, single precision should be adequate for cartesian XYZ values. Generally you will need to use double precision to work with latitude and longitude precisely. You may use either the double or float routines to write the dataref, depending on the precision you need. When a dataref is listed as double on the web page, it is internally stored in 64-bit double precision floating point format, but is accessible as both a float and a double for convenience. When a dataref is listed as float, it is internally stored in 32-bit floating point format. A Note on PrecisionĪll datarefs in this section are listed on the web page as either type int, float, or double. Generally most datarefs for positioning the user’s aircraft are contained in sim/flightmodel/position/. Example: visualizing flight data recorder information.
#Flight simulator x airplanes how to
This note describes how to position the user’s aircraft or multiplayer aircraft in X-Plane.