Manipulators

A manipulation is an action the user can take by clicking on your object. (That is, the user "manipulates" your OBJ with the mouse.) Manipulations can only be used on cockpit objects!

For detailed reference on the .obj file format, see http://scenery.x-plane.com/library.php?doc=obj8spec.php.

= Types of Manipulators =

There are six types of manipulators supported in X-Plane 920:
 * None
 * Panel Click
 * Drag-Axis
 * 2-d Drag
 * Command
 * Command-Axis
 * Opaque

No Manipulation
Triangles are ignored when clicking. This is the default, and is usually used for anything that is not clickable. This manipulation does not require any CPU resources, so when possible, you want to leave your meshes non-manipulatable. This is the only legal manipulation for non-cockpit objects.

The none manipulation is set using either ATTR_no_cockpit ATTR_manip_none The none-type manipulation will show no tool tips, and uses the arrow (default) cursor.

Panel Click Manipulation
A click on the triangles is mapped through to the 2-d panel based on the panel texture's mapping. This manipulation can only be specified for objects that are textured by the panel texture (or a panel texture region). Panel click manipulation is set using one of ATTR_cockpit ATTR_cockpit_region

Panel click manipulations show the tooltips and cursors of the 2-d panel.

Drag-Axis Manipulation
As the user drags along an axis in 3-d object-space, a dataref value is increased or decreased. The length of the axis defines how much mouse travel (in meters of object space) is required to completely change the dataref across a range defined by a pair of parameters. The drag-axis manipulator takes the form: ATTR_manip_drag_axis    Here, x, y and z define the length and direction of the drag axis, and value1 and value2 define the range of values over which the manipulator runs. If the mouse is dragged beyond either of these limits, the manipulator is clamped: the value of the dataref will remain the same until the mouse is again dragged or clicked within range. The current value is retained after the mouse is released, and determines the position of the manipulator's drag-axis relative to the next mouse click. For example, if a manipulator is currently set to a value midway between it's minimum and maximum values, then the mouse will automatically find itself halfway along that manipulator's drag-axis when next it clicks on it.

Drag-axis manipulation is subject to object animation. The orientation of the manipulator's drag-axis relative to the animated mesh to which it is attached is the same each time the mouse is clicked on it. For example, if a drag-axis manipulator on an animated throttle lever has an axis perpendicular to the lever shaft when clicked in the 'idle' position, that axis will still be perpendicular to the lever shaft when clicked in the 'open' position. However, for the duration of any given drag, the orientation of the drag-axis relative to the aircraft remains constant. So if the drag-axis of the previously-described manipulator happens to be perfectly horizontal at the moment the mouse is clicked on it, it will remain perfectly horizontal and 'locked-in' until the mouse is released, even though the visible throttle lever has been animated to a new position. This behaviour is more intuitive in practice than it may appear on paper!

2-d Drag Manipulation
The 2-d drag manipulator effectively combines two manipulators into one, allowing two datarefs to be modified simultaneously by dragging the mouse along a pair of perpendicular axes. To minimise input ambiguity, the axes are defined in 2-d screen space, not object space, and their respective orientations are fixed. The first dataref is modified by dragging the mouse horizontally across the screen and the second by dragging vertically. This type of manipulator would typically be used to control a yoke or joystick and takes the form: ATTR_manip_drag_xy  .

Here, x defines the distance the mouse must be dragged across the screen from left to right in order to modify the output of dataref1 from ref1 value1 to ref1 value2. Similarly, y defines the distance the mouse must be dragged up the screen in order to vary the output of dataref2 from ref2 value1 to ref2 value2.

In contrast to the drag-axis manipulator, the axis orientations of the 2-d drag manipulator are not subject to object animation. The x-axis is always horizontal and the y-axis is always vertical. However, the location of the manipulator's click-region does follow any animation of it's mesh.

The following example shows a 2-d drag manipulator configured to control a steering yoke. The x-axis controls roll (an 80-pixel drag), and the y-axis controls pitch (a 50-pixel drag). Note: since it is more intuitive to drag down rather than up the screen in order to increase pitch, the vertical axis has been assigned a negative value): ATTR_manip_drag_xy  four_arrows  80  -50  -1  1  -1 1  sim/cockpit2/controls/yoke_roll_ratio  sim/cockpit2/controls/yoke_pitch_ratio  I am a tooltip. It is not obligatory for a 2-d drag manipulator to address two datarefs. A single dataref may be manipulated in 2-d screen-space by entering a value of 0 for each of the redundant numeric parameters and null for the dataref name of the unassigned axis.

Command Manipulation
A command manipulation invokes an X-Plane command when the mouse is clicked on it. The command continues to be invoked until the mouse is released. It takes the form: ATTR_manip_command

Command-Axis Manipulation
Dragging along a specified object-space axis actuates one of a pair of commands, subject to the direction of the drag. The command continues to be invoked (CommandContinue phase) until such time as the mouse is either released or else dragged back along the axis to the neutral position. Dragging right through the neutral position to the opposite end of the axis invokes the second command. The neutral position is centred on the location of the original mouse click and occupies 40% of the overall length of the axis Typical applications would be nudge-wheels and three-position toggle switches. The command-axis manipulator takes the form: ATTR_manip_command_axis    The x, y, and z parameters define the orientation and length in meters of the drag-axis. Dragging in the positive direction triggers command 1 and in the negative direction, command 2. The following example shows a command_axis manipulator configured as a pitch trim nudge-wheel/switch: ATTR_manip_command_axis up_down 0.00  0.00  -0.01 sim/flight_controls/pitch_trim_down  sim/flight_controls/pitch_trim_up I am also a tooltip. The axis values in the above example would be appropriate for a standard-sized toggle switch mounted on a horizontal console panel. Dragging the mouse approximately 2mm towards the nose of the aircraft triggers pitch_trim_down, and dragging it 2mm towards the tail triggers pitch_trim_up (since the X-Plane acf z-axis runs positive nose to tail).

Opaque Manipulation
This sets the manipulation to 'no-op' (no operation). Unlike "none" manipulation, opaque manipulation "swallows" the mouse, preventing it from clicking on other manipulators that may lie behind it. It would typically be used to act as a safety-guard over a switch.

Dataref "Button" Manipulators
New to 930: these manipulators change a dataref when the mouse is clicked or held, creating button-like functionality. There are five sub-flavors. The push-button, radio button, and toggle manipulators are meant to provide button-like behavior for a mesh. The delta and wrap manipulators are meant to be used to create invisible "hot spots" over a mesh.

Push-Button Manipulator
The push-button manipulator sets a dataref to a "down" value when the mouse is clicked, then back to an "up" value when the mouse button is released.

Radio Button Manipulator
The radio button manpiulator sets a dataref to a value each time it is clicked.

(It is considered to be a "radio button" because a set of these manipulators, sharing one dataref but using differing values, can create radio-button-like behavior.)

Toggle Manipulator
The toggle manipulator switches a dataref between one of two values each time it is clicked.

Delta Manipulator
The dataref is increased (or decreased) when the button is clicked (and/or held down). If the dataref exceeds its limit range, it is clamped to that limit.

Wrapping Manipulator
The dataref is increased (or decreased) when the button is clicked (and/or held down). If the dataref exceeds its limit range, it wraps around to the other end of the range.

= Manipulator Properties =

These properties apply to some or all of the manipulators except for:
 * None and opaque manipulators (which have no real action).
 * Panel manipulator (which gets its properties from the panel).

Cursor
All manipulators let you specify the cursor that appears when the mouse is over the manipulator. (The panel manipulator takes its cursor from the underlying panel.) The OBJ8 specification lists all possible cursor choices.

3-D Axis
The axis and command-axis manipulators allow a drag in 3-d; they require the specification of an axis.


 * The axis is a 3-d axis, so it is specified as a length in X, Y, and Z (in meters).
 * This axis is affected by animation; if the manipulator is inside a rotation, the axis will rotate.
 * The axis manipulators imply an "increasing" and "decreasing" direction; the values specify the increasing direction.

EXAMPLE: for an axis of X = 1, Y = 1, Z = 0, as you drag to the upper right (in object coordinates) the dataref will increase.

The axis's position in the 3-d cockpit is set based on the current value of the dataref when the user clicks. For example, if the dataref for the axis manipulator is the throttles and the throttles are at maximum value, the entire axis will be in the direction to decrease the throttles. If the throttles are at 50%, the mid-point of the axis will be at the click point. In other words, axis positioning is relative based on the dataref.

(For the command-axis, the axis center is always the anchor point.)

2-D Axis
The 2-d drag axis is a special case: it allows a drag in "screen space" - that is, the axes is always up-down and left-right no matter what the pilot head position. Thus the axes are lengths in pixels. A positive "x" means that a drag to the right increases the first dataref. A positive "y' means a drag up increases the first dataref

Datarefs and Values
For the axis and axis-2 manipulators, one or two datarefs is required, as well as low and high values. The low and high values "scale" the axis. For example, for a throttle, a low and high value of 0.0 and 1.0 would tell the manipulator what throttle values correspond with the end of the axis.

(In other words, the axis specifies the size in the 3-d cockpit of the drag, and the dataref values specify the size in terms of the actual dataref movement.)

Commands
A command can be specified for either the command manipulator (the command is invoked while the mouse button is held down) or the command-axis dataref (the command is invoked while the drag is to the left or right of the axis).

Tooltips
All manipulators let you specify a tooltip. When the mouse lingers over the manipulator region and the user enables "instrument explanations", this tooltip will be shown. It provides a way to provide custom panel instructions. Tooltips may not have return characters. (For the panel manpulator, the tool tip is taken from the underlying 2-d manipulator.)

= Manipulation On Older Versions of X-Plane =

Before X-Plane 920, there were only two ways to interact with the panel:
 * Clicks to object-textured geometry would go right through the geometry (equivalent to the "none" manipulator).
 * Clicks to panel-textured geometry would cause panel clicks (equivalent to the "panel" manipulator).

Because ATTR_cockpit, ATTR_cockpit_region, and ATTR_no_cockpit set the manipulator as well, these behaviors are "automatic".

AC3D Note: if you edit 3-d cockpits in AC3D using the new version 3.2 plugin, you will need to set the panel manipulator in order to have panel clicking work!