This is the second part of a blog chronicling the development of a FlightGear simulator model for the Open Source Space Plane.
Animating retractable landing gear , control surfaces, etc, involves linking a 3D object movement to a flight model variable.
This is done in the main xml file in the Model subfolder.
For example:
<animation>
<type>rotate</type>
<object-name>nosegear</object-name>
<property>gear/gear[0]/position-norm</property>
<factor>90</factor>
<offset-deg>-90</offset-deg>
<center>
<x-m>-13</x-m>
<y-m>0.0</y-m>
<z-m>2</z-m>
</center>
<axis>
<x>0</x>
<y>1</y>
<z>0</z>
</axis>
</animation>
This animation will model the nose gear retraction and extension.
Let’s go through it line by line:
<animation> Start of animation definition XML node
<type>rotate</type> This will be a rotation
<object-name>nosegear</object-name> The object that will rotate. You can define an object in a separate XML file which links to a 3D model, and in turn link to that XML file from this file:
<model>
<name>nosegear</name>
<path>nosegear.xml</path>
</model>
<property>gear/gear[0]/position-norm</property> The variable that drives the rotation, in this case a normalized value of the first gear position
<factor>90</factor> A multiplication factor of 90 on a normalized position of 0-1would visually rotate the gear 90 degrees
<offset-deg>-90</offset-deg> This allows you to define the start angle and I guess depends on how the 3D model of the gear was defined.
<center>
<x-m>-13</x-m>
<y-m>0.0</y-m>
<z-m>2</z-m>
</center> This is the center of rotation , it will probably need some tweaking. It’s linked to the JSBSim model via the VRP reference point.
<axis>
<x>0</x>
<y>1</y>
<z>0</z>
</axis> This is the axis of rotation, in this case parallel to the lateral axis of the aircraft.
</animation> Close the animation node
More resources on FlightGear modeling and animation here: