Rectractable Landing Gear

Once a model is created, the next step is to make the landing gear retractable.  For testing the concept, start with the PC-9 1/10 scale model. 

The landing gear is specified by name in the configuration file as     in the Sport.xml file for example.  The animation settings are specified in that file.   The parts of the 3D model can be labelled in Wings 3D, and other editors, and any animation specified will move this part only.

Naming the right landing gear as 'right-gear'  as in     <object name="right_gear" max_angle="1.57" />  in the 3D model file as shown,  and using the sport.xml file to control the model as follows:  copy the sport.xml to pc9.xml for example, and change the model name from sport.ac to pc9.3ds.

Next, take off and press G to retract the landing gear. This can be done on the ground with the results shown.

In the first instance,  the landing gear appears retracted above the wing.

View in test mode, gear can be raised and lowered for testing animations

What went wrong? The landing gear retracted, but its final position is above the wing, and the angle seems to be a little too much. The position of the retracting gear needs to be adjusted.  

The settings are as follows: 

<animations>

    <animation type="ControlSurface">

      <!-- right gear -->

      <object name="right_gear" max_angle="1.57" />

      <control mapping="RETRACT" gain="-1.0" />

      <hinge x="-0.09" y="0.67" z="0.12" />

      <hinge x="-1.09" y="0.67" z="0.12" />

    </animation>

Changing the Y position of the hinge setting to the following results in the wheel being retracted into a position some distance below the wing.  This is the correct setting, so, the correct point is somewhere between the two.

<hinge x="-0.09" y="0.27" z="0.12" />

<hinge x="-1.09" y="0.27" z="0.12" />

Let's try:

<hinge x="-0.09" y="0.47" z="0.12" />

<hinge x="-1.09" y="0.47" z="0.12" />

This time the gear can be seen faintly potruding from the top of the wing surface.  Since decreasing the Y value moves the gear position down , that is, the final retracted position down, the  value has to be reduced a little more.

<hinge x="-0.09" y="0.41" z="0.12" />

<hinge x="-1.09" y="0.41" z="0.12" />

This turns out to be too low, so the final setting is 0.46, where the wheels are seen slightly lower than the surface of the wing. 

Viewing the model in test mode (toggle test mode) is useful for this purpose, and I find the model is too dark, lighting values need to be adjusted as well.

Now all that remains is the rename the left gear, front gear, and assign the changed positions to those gear units as above.

The left gear and wheel are combined into one object in Wings 3D using the rename option on right clicking the object.

The model was copied into the objects folder, and (after changing the name in the .xml file config file to match the new model) the PC9 was flown.   Retracting the gear resulted in the up position of the gear being in the wrong place.  

Original Setting from the sport.xml file

<animation type="ControlSurface">

      <!-- nose gear -->

      <object name="nose_gear" max_angle="1.625" />

      <control mapping="RETRACT" gain="1.0" />

      <hinge x="0.42" y="-0.04" z="0.10" />

      <hinge x="0.42" y="-1.04" z="0.10" />

    </animation>

Changed setting for nose gear to retract correctly

<animation type="ControlSurface">

      <!-- nose gear -->

      <object name="nose_gear" max_angle="1.40" />

      <control mapping="RETRACT" gain="1.0" />

     <hinge x="0.42" y="-0.04" z="-0.46" />

      <hinge x="0.42" y="-1.00" z="-0.46" />

    </animation>

  I made this special note inside the file.  Z is the up and down coordinate.  

<!-- right gear NOTE With gears,  Y is left/right, X is rear/aft, Z is up/down-->

After much experimenting, I got the nose gear to retract to s position inside the fuselage  and not under it.  Apparently, the specification denotes a "hinge" from y=-0.04 to y = -1.00  and a final Z position, though it does not explain everything.  At the moment, it just works.