AN-12BK Version: 5.0.3 (Development for FlightGear)

in #utopian-io5 years ago

Repository

https://github.com/HerbyW/AN-12BK

Introduction

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
fgfs-20190527155707.png

fgfs-20190527155815.png

New Features

New version number (AN-12BK-base.xml)

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.

New Flightrecorder

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><property type="string">sim/weight[3]/weight-lb</property>
</signal>  
<signal>
         <type>bool</type><property type="string">controls/lighting/nav-lights</property>
</signal>
FDM (flight dynamics model)

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"/> 
Model Shadow (Models/AN-12BK.xml)

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>
Pick animation added (Models/AN-12BK.xml)

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>  
New ambient lights for the cargo door (Models/AN-12BK.xml)

fgfs-20190527155221.png

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>
Adjusting a change in FlightGear

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

New cat animation added

fgfs-20190527155622.png

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.

(html comment removed:  Cat Head movement )
    <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><dep> 0.0 </dep></entry>
            <entry><ind> 0.3 </ind><dep> 50.0 </dep></entry>
            <entry><ind> 1.0 </ind><dep> 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>  
New glass lights for position and navigation lamps

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

Screenshot_20190527_211710.png
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:
Screenshot_20190527_211814.png
The beacon lamp
Screenshot_20190527_212030.png
and the beacon for not Rembrandt:
Screenshot_20190527_212106.png
The position lamps are the same in both systems. A sphere is added and scaled:
Screenshot_20190527_212329.png
then put to the place on the model:
Screenshot_20190527_212253.png

Fly-By View shortcut added (Nasal/AN-12BK-keyboard.xml)
<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> 

Roadmap

Checking new versions of FlightGear for updates and changes in the format of code before errors come up.

How to contribute?

Pull request to my github repository or direct contact via Mumble FlightGear Chat.

GitHub Account

https://github.com/HerbyW
It contains my real name, my git username, my steemit username and my callsign in the multiplayer.

Sort:  
  • Good article with images, code samples and explanations.
  • Cats make everything more pleasing. ;-)

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thank you for your review, @helo! Keep up the good work!

So many Updates and active nodes/code that help for better animation on light effects and signaling. This is outstanding flying project as always.

Posted using Partiko Android

Hey, @schamangerbert!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Very interesting review @schamangerbert and animation of the cat especially pleased!

This post has received a 28.41 % upvote from @boomerang.

Hi @schamangerbert!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Coin Marketplace

STEEM 0.32
TRX 0.11
JST 0.034
BTC 66761.99
ETH 3256.83
USDT 1.00
SBD 4.27