Board index FlightGear Development Scenery

The animated jetway project

Questions and discussion about enhancing and populating the FlightGear world.

Re: Movable jetways

Postby skyop » Sat Aug 14, 2010 12:11 am

I've revised the jetway code, it now moves at the same pace based on the rotation angles instead of a fixed number of seconds.

Here's a line from the new script:
Code: Select all
if ((getprop("/scenery/airport/jetway[0]/door[0]/position-norm") == 0 and getprop("/scenery/airport/jetway[0]/door[1]/position-norm") == 0 and getprop("/scenery/airport/jetway[0]/door[2]/position-norm") == 0 and getprop("/scenery/airport/jetway[0]/door[3]/position-norm") == 0 and getprop("/scenery/airport/jetway[0]/door[4]/position-norm") == 0) or (getprop("/scenery/airport/jetway[0]/door[0]/position-norm") == 1 and getprop("/scenery/airport/jetway[0]/door[1]/position-norm") == 1 and getprop("/scenery/airport/jetway[0]/door[2]/position-norm") == 1 and getprop("/scenery/airport/jetway[0]/door[3]/position-norm") == 1 and getprop("/scenery/airport/jetway[0]/door[4]/position-norm") == 1))


I think I just set a new record for "FlightGear's longest nasal if condition." :lol:
Aircraft: [ CRJ700-family | DC-10-30 ] Scenery: [ KBFL ]
skyop
 
Posts: 3040
Joined: Mon Jun 14, 2010 1:40 am
Location: Austin, Texas, USA
IRC name: skyop
Version: next
OS: Fedora 23/Windows 10

Re: Movable jetways

Postby skyop » Sat Aug 14, 2010 1:24 am

Video of the new version:

http://tinypic.com/player.php?v=ajul44&s=4

Tell me that's too fast. TELL. ME. THAT'S. TOO. FAST. :lol:
Aircraft: [ CRJ700-family | DC-10-30 ] Scenery: [ KBFL ]
skyop
 
Posts: 3040
Joined: Mon Jun 14, 2010 1:40 am
Location: Austin, Texas, USA
IRC name: skyop
Version: next
OS: Fedora 23/Windows 10

Re: Movable jetways

Postby nickyivyca » Sat Aug 14, 2010 2:12 am

That's good. :D

Now you need to animate the little wheels on the bottom so that they turn to move the jetway around!
Personal Fleet: 787-8, CRJ-200, 737-300, MD-81, DHC-3A, Beechcraft Starship
New hangar!
Curent projects: New 787, New CRJ-200, DC-9, New 777-200ER FDM
User avatar
nickyivyca
 
Posts: 1254
Joined: Tue Dec 29, 2009 6:42 am
Location: Near KSFO, closer to KPAO
Callsign: Nick, ---206
Version: 2
OS: Win 7 (64)

Re: Movable jetways

Postby skyop » Sat Aug 14, 2010 2:15 am

nickyivyca wrote:Now you need to animate the little wheels on the bottom so that they turn to move the jetway around!


Eh... not that big of a deal- it will be very hard to animate properly anyway. Besides, FSX doesn't do this, so why should I? :lol:
Aircraft: [ CRJ700-family | DC-10-30 ] Scenery: [ KBFL ]
skyop
 
Posts: 3040
Joined: Mon Jun 14, 2010 1:40 am
Location: Austin, Texas, USA
IRC name: skyop
Version: next
OS: Fedora 23/Windows 10

Re: Movable jetways

Postby AndersG » Sat Aug 14, 2010 12:56 pm

Hi,

Nice idea. Here is a suggestion on how to control each jetway separately:

1. Make the animation properties in jetway-movable.xml easy to override.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Movable jetway for FlightGear.

  Copyright (C) 2010  skyop
  Copyright (C) 2010  Anders Gidenstam  (anders(at)gidenstam.org)
  This file is licensed under the GPL license version 2 or later.
-->
<PropertyList>

 <!-- Overlay these to give each jetway a unique identity. -->
 <params>
  <click-action-script>jetways.default.click();</click-action-script>
  <rotation-y-deg>/scenery/airport/jetway/jetway-y-rot</rotation-y-deg>
  <rotation-z-deg>/scenery/airport/jetway/jetway-z-rot</rotation-z-deg>
  <translation-x-m>/scenery/airport/jetway/jetway-x-tra</translation-x-m>
  <entrance-rotation-z-deg>/scenery/airport/jetway/entrance-z-rot</entrance-rotation-z-deg>
  <hood-rotation-y-deg>/scenery/airport/jetway/hood-y-rot</hood-rotation-y-deg>
 </params>

 <path>jetway-movable.ac</path>

 <nasal>
  <load>
    print("LOAD jetway-movable.xml");
  </load>
 </nasal>

 <animation>
  <type>pick</type>
  <action>
   <button>0</button>
   <repeatable>false</repeatable>
   <binding>
    <command>nasal</command>
    <script alias="../../../../params/click-action-script"/>
   </binding>
  </action>
 </animation>

 <animation>
  <type>rotate</type>
  <object-name>Tunnel1</object-name>
  <object-name>Tunnel2</object-name>
  <object-name>Rotunda2</object-name>
  <object-name>Entrance</object-name>
  <object-name>Hood</object-name>
  <property alias="../../params/rotation-y-deg"/>
  <factor>-1</factor>
  <center>
   <x-m>1.5</x-m>
   <y-m>0</y-m>
   <z-m>4</z-m>
  </center>
  <axis>
   <x>0</x>
   <y>1</y>
   <z>0</z>
  </axis>
 </animation>

 <animation>
  <type>rotate</type>
  <object-name>Tunnel1Rotunda</object-name>
  <object-name>Tunnel1</object-name>
  <object-name>Tunnel2</object-name>
  <object-name>Tunnel3</object-name>
  <object-name>Rotunda2</object-name>
  <object-name>Entrance</object-name>
  <object-name>Hood</object-name>
  <property alias="../../params/rotation-z-deg"/>
  <factor>1</factor>
  <center>
   <x-m>0</x-m>
   <y-m>0</y-m>
   <z-m>0</z-m>
  </center>
  <axis>
   <x>0</x>
   <y>0</y>
   <z>1</z>
  </axis>
 </animation>

 <animation>
  <type>translate</type>
  <object-name>Tunnel2</object-name>
  <object-name>Tunnel3</object-name>
  <object-name>Rotunda2</object-name>
  <object-name>Entrance</object-name>
  <object-name>Hood</object-name>
  <property alias="../../translation-x-m"/>
  <factor>1</factor>
  <axis>
   <x>1</x>
   <y>0</y>
   <z>0</z>
  </axis>
 </animation>

 <animation>
  <type>rotate</type>
  <object-name>Entrance</object-name>
  <object-name>Hood</object-name>
  <property alias="../../params/entrance-rotation-z-deg"/>
  <factor>-1</factor>
  <center>
   <x-m>19.536</x-m>
   <y-m>0.081</y-m>
   <z-m>0</z-m>
  </center>
  <axis>
   <x>0</x>
   <y>0</y>
   <z>1</z>
  </axis>
 </animation>

 <animation>
  <type>rotate</type>
  <object-name>Hood</object-name>
  <property alias="../../params/hood-rotation-y-deg"/>
  <factor>-1</factor>
  <center>
   <x-m>0</x-m>
   <y-m>2.019</y-m>
   <z-m>3.852</z-m>
  </center>
  <axis>
   <x>1</x>
   <y>0</y>
   <z>0</z>
  </axis>
 </animation>

 <animation>
  <object-name>Marker</object-name>
  <enable-hot type="bool">false</enable-hot>
 </animation>

</PropertyList>


2. Move the Nasal code into a "class" that can be instantiated for each jetway. This is a skeleton to build on (put it in the main Nasal directory):
Code: Select all
###############################################################################
##
##  Movable jetways control for FlightGear.
##
##  Copyright (C) 2010  Anders Gidenstam  (anders(at)gidenstam.org)
##  Copyright (C) 2010 ...
##  This file is licensed under the GPL license version 2 or later.
##
###############################################################################

# root_path should be, e.g. /scenery/KNUQ/terminal[0]/jetway[0]/
var jetway = {
    new : func (root_path) {
        var obj = { parents : [jetway] };
        obj.root = props.globals.getNode(root_path, 1);
        return obj;
    },
    click : func {
        print("Jetway " ~ me.root.getPath() ~ " clicked!");
    } 
};

# The default jetway instance.
var default = nil;

_setlistener("/sim/signals/nasal-dir-initialized", func {
    default = jetway.new("/scenery/airport/jetway");
});


3. Each jetway needs to be instantiated with a unique identity. This is not very convenient, but it works. Here is an example XML file for a terminal (ESGB terminal 0) with 2 jetways:
Code: Select all
<?xml version="1.0"?>
<!-- (C) 2010  Anders Gidenstam. Distribution: GPL v2 or later. -->
<PropertyList>

 <path>ESGB_terminal.ac</path>

 <model>
  <path>Models/Airport/jetway-movable.xml</path>
  <offsets>
   <x-m>  20.00 </x-m>
   <y-m>   0.00 </y-m>
   <z-m>   0.00 </z-m>
  </offsets>
  <overlay>
   <params>
    <!-- We have to override all the parameters to connect them to unique properties. -->
    <click-action-script>scenery.ESGB.terminal[0].jetway[0].click();</click-action-script>
    <rotation-y-deg>/scenery/ESGB/jetway[0]/jetway-y-rot</rotation-y-deg>
    <rotation-z-deg>/scenery/ESGB/jetway[0]/jetway-z-rot</rotation-z-deg>
    <translation-x-m>/scenery/ESGB/jetway[0]/jetway-x-tra</translation-x-m>
    <entrance-rotation-z-deg>/scenery/ESGB/jetway[0]/entrance-z-rot</entrance-rotation-z-deg>
    <hood-rotation-y-deg>/scenery/ESGB/jetway[0]/hood-y-rot</hood-rotation-y-deg>
   </params>   
  </overlay>
 </model>
 <model>
  <path>Models/Airport/jetway-movable.xml</path>
  <offsets>
   <x-m>  20.00 </x-m>
   <y-m>  20.00 </y-m>
   <z-m>   0.00 </z-m>
  </offsets>
  <overlay>
   <params>
    <!-- We have to override all the parameters to connect them to unique properties. -->
    <click-action-script>scenery.ESGB.terminal[0].jetway[1].click();</click-action-script>
    <rotation-y-deg>/scenery/ESGB/jetway[1]/jetway-y-rot</rotation-y-deg>
    <rotation-z-deg>/scenery/ESGB/jetway[1]/jetway-z-rot</rotation-z-deg>
    <translation-x-m>/scenery/ESGB/jetway[1]/jetway-x-tra</translation-x-m>
    <entrance-rotation-z-deg>/scenery/ESGB/jetway[1]/entrance-z-rot</entrance-rotation-z-deg>
    <hood-rotation-y-deg>/scenery/ESGB/jetway[1]/hood-y-rot</hood-rotation-y-deg>
   </params>   
  </overlay>
 </model>

 <nasal>
  <load>
    #print("LOAD ESGB_terminal.xml");

    # Make sure the hash scenery.ESGB.terminal[0] exists.
    if (!contains(globals, "scenery"))
        globals["scenery"] = {};
    if (!contains(scenery, "ESGB"))
        scenery["ESGB"] = {};
    if (!contains(scenery.ESGB, "terminal"))
        scenery.ESGB["terminal"] = {0: {}};

    # Instantiate the jetway controllers.
    scenery.ESGB.terminal[0].jetway =
        [jetways.jetway.new("/scenery/ESGB/terminal[0]/jetway[0]"),
         jetways.jetway.new("/scenery/ESGB/terminal[0]/jetway[1]")];

    # Print the lot for inspection.
    #debug.dump(scenery.ESGB);
  </load>
 </nasal>

</PropertyList>


Going down this route would IMHO result in something we can include in FlightGear without much hesitation.

Cheers,

Anders
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2524
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: Movable jetways

Postby HHS » Sat Aug 14, 2010 1:17 pm

skyop wrote:
Eh... not that big of a deal- it will be very hard to animate properly anyway. Besides, FSX doesn't do this, so why should I? :lol:

Just to show that you (or we= FlightGear) can better! :wink:
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: Movable jetways

Postby skyop » Sat Aug 14, 2010 4:05 pm

AndersG wrote:Nice idea. Here is a suggestion on how to control each jetway separately:


FINALLY! :D I'll see if I can implement it. My only sticking point is

AndersG wrote:3. Each jetway needs to be instantiated with a unique identity. This is not very convenient, but it works


My hope was that it'd be easy as "add jetway-movable.xml to the *.stg file and put it wherever you want." :(
Aircraft: [ CRJ700-family | DC-10-30 ] Scenery: [ KBFL ]
skyop
 
Posts: 3040
Joined: Mon Jun 14, 2010 1:40 am
Location: Austin, Texas, USA
IRC name: skyop
Version: next
OS: Fedora 23/Windows 10

Re: Movable jetways

Postby HHS » Sat Aug 14, 2010 4:31 pm

skyop wrote: My only sticking point is

AndersG wrote:3. Each jetway needs to be instantiated with a unique identity. This is not very convenient, but it works


My hope was that it'd be easy as "add jetway-movable.xml to the *.stg file and put it wherever you want." :(


Yes, that shows NASAL of its best! (Another thing I want to get more detailed explained....)

As I understood,( he might correct me) it is just one .xml-file, which contains all jetways needed.

From scenery-modellers view this has advantages and disadvantages:
+ less .xml --> better fps-perfomance! (many .xml and especially with nasal slows down the sim noticeably)

- setting positions of the jetways relative to the buidlings could be a bit difficult.

Nethertheless, I think there is no better way just right now! :-)
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: Movable jetways

Postby nickyivyca » Mon Aug 16, 2010 3:11 am

Introducing a couple more aircraft with jetways implemented...

CRJ-200:
Image

787-8, two jetways:
Image
[Note: Using the alpha (fast) release, when I was moving the jetways around, the outer one collided with engine #1, causing a crash to be detected. When I release the next 787, the second jetway info will be commended out, unless skyop fixes this.]
Personal Fleet: 787-8, CRJ-200, 737-300, MD-81, DHC-3A, Beechcraft Starship
New hangar!
Curent projects: New 787, New CRJ-200, DC-9, New 777-200ER FDM
User avatar
nickyivyca
 
Posts: 1254
Joined: Tue Dec 29, 2009 6:42 am
Location: Near KSFO, closer to KPAO
Callsign: Nick, ---206
Version: 2
OS: Win 7 (64)

Re: Movable jetways

Postby zakalawe » Mon Aug 16, 2010 8:53 am

I'm not sure a jetway makes sense for a CRJ-200 :)
zakalawe
 
Posts: 1259
Joined: Sat Jul 19, 2008 5:48 pm
Location: Edinburgh, Scotland
Callsign: G-ZKLW
Version: next
OS: Mac

Re: Movable jetways

Postby skyop » Mon Aug 16, 2010 11:04 pm

zakalawe wrote:I'm not sure a jetway makes sense for a CRJ-200 :)


You'd be surprised... :P
Aircraft: [ CRJ700-family | DC-10-30 ] Scenery: [ KBFL ]
skyop
 
Posts: 3040
Joined: Mon Jun 14, 2010 1:40 am
Location: Austin, Texas, USA
IRC name: skyop
Version: next
OS: Fedora 23/Windows 10

Re: Movable jetways

Postby skyop » Mon Aug 16, 2010 11:15 pm

nickyivyca wrote:[Note: Using the alpha (fast) release, when I was moving the jetways around, the outer one collided with engine #1, causing a crash to be detected. When I release the next 787, the second jetway info will be commended out, unless skyop fixes this.]


Preventing the jetway from colliding with the engine will be pretty complicated, but in the meantime I can tell the sim not to trigger a crash if it does collide.
Aircraft: [ CRJ700-family | DC-10-30 ] Scenery: [ KBFL ]
skyop
 
Posts: 3040
Joined: Mon Jun 14, 2010 1:40 am
Location: Austin, Texas, USA
IRC name: skyop
Version: next
OS: Fedora 23/Windows 10

Re: Movable jetways

Postby nickyivyca » Tue Aug 17, 2010 2:48 am

zakalawe wrote:I'm not sure a jetway makes sense for a CRJ-200 :)


But it must, if it happened in real life... :P

Image
Personal Fleet: 787-8, CRJ-200, 737-300, MD-81, DHC-3A, Beechcraft Starship
New hangar!
Curent projects: New 787, New CRJ-200, DC-9, New 777-200ER FDM
User avatar
nickyivyca
 
Posts: 1254
Joined: Tue Dec 29, 2009 6:42 am
Location: Near KSFO, closer to KPAO
Callsign: Nick, ---206
Version: 2
OS: Win 7 (64)

Re: Movable jetways

Postby skyop » Tue Aug 17, 2010 4:33 am

HHS wrote:As I understood,( he might correct me) it is just one .xml-file, which contains all jetways needed.


Well, here's how his system works:

  • An XML model file is created where all the animations for the jetway are stored. Parameters are set so that they can be called dynamically.
  • In a terminal's XML file, the jetway is called as a submodel. The parameters are set (manually, mind you) differently for each jetway so that they can function independently.

So this uses even more XML files than the original system. It also adds a whole layer of complication, IMO. What we need is a way for Nasal to dynamically set the parameters, not the XML file (which can only do static assignments).
Aircraft: [ CRJ700-family | DC-10-30 ] Scenery: [ KBFL ]
skyop
 
Posts: 3040
Joined: Mon Jun 14, 2010 1:40 am
Location: Austin, Texas, USA
IRC name: skyop
Version: next
OS: Fedora 23/Windows 10

Re: Movable jetways

Postby zakalawe » Tue Aug 17, 2010 9:35 am

nickyivyca wrote:
zakalawe wrote:I'm not sure a jetway makes sense for a CRJ-200 :)


But it must, if it happened in real life...

Is that jetway actually attached? I can see the stairs of the CRJ below the fuselage (but that could just be because the door is open), and, well, I can't honestly decide if that jetway is actually attached to the aircraft or just close to it.

Oh well!
zakalawe
 
Posts: 1259
Joined: Sat Jul 19, 2008 5:48 pm
Location: Edinburgh, Scotland
Callsign: G-ZKLW
Version: next
OS: Mac

PreviousNext

Return to Scenery

Who is online

Users browsing this forum: SurferTim and 4 guests