https://github.com/HerbyW/AN-12BK
FlightGear (http://www.flightgear.org) is an open source flight simulator that is even used in flight schools to train basic maneuvers, radio communication and navigation tasks. It is available for windows, mac and linux.
In this article I want to go through my latest commit to further improve the development of the AN-12BK, a four-engined turboprop transport aircraft. It is currently very popular with cargo operators worldwide and had its first flight in 1957.
https://github.com/HerbyW/AN-12BK/commit/7979019dd43627be559b265c0fbe04865b7558cf
The final result in both light systems: with Rembrandt and without
The new number is 5.0.3, it is transmitted over the multiplayer layout. There are no changes in the multiplayer layout so that it is compatible with older versions and makes the aircraft more beautiful and fits the new version of FlightGear 2019.3.2.
It is referenced in AN-12BK-base.xml:
<flight-recorder include="Systems/flightrecorder.xml"/>
All animations and flight controls are recorded, as an example three snippets for recording the generic information of 4 turboprop engines, weight[3] - the cargo boxes, and the navigation lights:
<signals include="/Aircraft/Generic/flightrecorder/components/engine-turboprop.xml">
<count type="int">4</count>
</signals>
<signal>
<type>float</type>sim/weight[3]/weight-lb</property>
</signal>
<signal>
<type>bool</type>controls/lighting/nav-lights</property>
</signal>
The reaction speed of the elevator is changed from 5 to 7 seconds, now it reacts more softer (AN-12BK-yasim.xml):
-<control-speed control="FLAP0" transition-time="5.0"/>
+<control-speed control="FLAP0" transition-time="7.0"/>
With the following code I switched off the shadow if the advanced light system Rembrandt is used, it brings its own shadow so a second one is not needed:
<condition>
<not><property>/sim/rendering/rembrandt/enabled</property></not>
</condition>
The pilot door below the cockpit is now clickable, I just added the name of the object in the animation definition:
<animation>
<type>pick</type>
<object-name>LaPorteduCote</object-name>
<object-name>pilotdoor</object-name>
This is the full code for adding one light, it calls a xml-file with the lamp definition, then it checks if float[12] is different from 0, this means the cargo door is not closed, and finally it tells the lamp where on the model it should be.
<model>
<path>Aircraft/AN-12BK/Models/light/BlueAmbientLight.xml</path>
<condition>
<property>sim/multiplay/generic/float[12]</property>
</condition>
<offsets>
<x-m> 12.96 </x-m>
<y-m> -0.48 </y-m>
<z-m> -1.05 </z-m>
</offsets>
</model>
I got a truncated error for my submodels and had to fix it.
Old:
<x-offset> -5 </x-offset>
<y-offset> 0 </y-offset>
<z-offset> -6.5 </z-offset>
New:
<offsets>
<x-m> 1.5 </x-m>
<y-m> 0 </y-m>
<z-m> -2 </z-m>
</offsets>
They changed the imperial system to the metric system and also the format for offsets. wiki
If you click the head of the cat it will turn to you now, this makes streams more entertaining. In the 3D ac-file I made the head a new element and added this animation (Models/Effects/stairs/cat.xml): It will change the value of the property "cat2" to 1 in 2 seconds and then back to 0 in 2 seconds.
<animation>
<type>pick</type>
<object-name>default.001</object-name>
<visible>true</visible>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>interpolate("controls/switches/cat2", 1, 2, 0, 2)</script>
</binding>
</action>
</animation>
<animation>
<type>rotate</type>
<object-name>default.001</object-name>
<property>controls/switches/cat2</property>
<interpolation>
<entry><ind> 0.0 </ind> 0.0 </dep></entry>
<entry><ind> 0.3 </ind> 50.0 </dep></entry>
<entry><ind> 1.0 </ind> 80.0 </dep></entry>
</interpolation>
<center>
<x-m> -0.0 </x-m>
<y-m> -0.0173 </y-m>
<z-m> 0.0265 </z-m>
</center>
<axis>
<x> 0 </x>
<y> 0 </y>
<z> 1 </z>
</axis>
</animation>
This is the greatest change in this commit. Here, in Models/light/an12-nav-pos-beacon-lights.xml are all definitions for all lamps. In Blender I made the 3D ac-file with the following elements:
beacon-cargo-door lampe
beacon-top-base
beacon-top lampe
BeaconVolume_1.001 top
BeaconVolume_1.002 back-down
LightBeaconGlow.001 top
LightBeaconGlow.002 back-down
nav-l-volume
nav-r-volume
navlight-l
navlight-r
pos-light-back
pos-light-back2
pos-light-front
pos-light-front2
The big elements are the "volumes", this parts are then filled with light.
The navigation and beacon lamps are made in two ways, as we have two light systems in FlightGear. The navigation lamps on the wing tips:
The beacon lamp
and the beacon for not Rembrandt:
The position lamps are the same in both systems. A sphere is added and scaled:
then put to the place on the model:
<key n="89">
<name>Y</name>
<desc>Change Pilot - FlyBy View</desc>
<binding>
<command>property-cycle</command>
<property>/sim/current-view/view-number</property>
<value>0</value>
<value>6</value>
</binding>
</key>
Checking new versions of FlightGear for updates and changes in the format of code before errors come up.
Pull request to my github repository or direct contact via Mumble FlightGear Chat.
https://github.com/HerbyW
It contains my real name, my git username, my steemit username and my callsign in the multiplayer.