Howto:Add aircraft lights

From FlightGear wiki
Revision as of 13:00, 2 March 2014 by Johan G (talk | contribs) (+-syntax highlighting: javascript → nasal)
Jump to navigation Jump to search

In order to add (the right) lights to your aircraft, you need to know what kind of lights planes are equipped with. Therefore it is suggested to read aircraft lighting first.

Anti-Collision Beacon lights

Nasal

var beacon_switch = props.globals.getNode("controls/switches/beacon", 2);
var beacon = aircraft.light.new( "/sim/model/lights/beacon", [0, 3], "/controls/lighting/beacon" );

Model

 <animation>
 <type>select</type>
 <object-name>Light</object-name>
 <condition>
 <property>/sim/model/lights/beacon/state</property>
 </condition>
 </animation>

Strobe lights

Nasal

var strobe_switch = props.globals.getNode("controls/switches/strobe", 2);
var strobe = aircraft.light.new( "/sim/model/lights/strobe", [0, 3], "/controls/lighting/strobe" );

Model

 <animation>
  <type>select</type>
  <object-name>Light</object-name>
  <condition>
   <property>/sim/model/lights/strobe/state</property>
  </condition>
 </animation>

Landing lights

Model

 <animation>
  <type>select</type>
  <object-name>Light</object-name>
  <condition>
   <property>controls/lighting/landing-light</property>
  </condition>
 </animation>

If the lights are located on the nosegear, use the one below instead. It will only show the lights when the landinggear is out. Change the value to make the light switch on when gear is out (vary from plane to plane, you can use the property browser to find the right value).

 <animation>
  <type>select</type>
   <object-name>Light</object-name>
   <condition>
    <and>
     <property>controls/lighting/landing-light</property>
     <greater-than>
      <property>gear/gear/position-norm</property>
      <value>0.05</value>
     </greater-than>
    </and>
   </condition>
 </animation>