Howto:Add aerotow hitch to an AI-aircraft

From FlightGear wiki
Jump to navigation Jump to search

For the visualization of the tow rope, it is advantageous if a hitch position is defined for the AI tow plane.

To set the hitch position for the AI aircraft, add the following code to the top of the {aircraft}-ai.xml file:

<?xml version="1.0"?>
<PropertyList>

<nasal>
  <load>
   var rplayer = cmdarg();
   rplayer.getNode("sim/hitches/aerotow/local-pos-x",1).setValue("x");  
   rplayer.getNode("sim/hitches/aerotow/local-pos-y",1).setValue("y"); 
   rplayer.getNode("sim/hitches/aerotow/local-pos-z",1).setValue("z"); 
  </load>
  <unload>
   rplayer.getNode("sim/hitches").remove();
  </unload>
</nasal>

  <!-- Rest of content here -->

</PropertyList>

In place of x, y, z, enter appropriate values for the hitch position. Coordinate system: x forward, y to the left, and z up. The units are meters.

That's it! The tow rope ends at the defined position.

Related content