Gyroscope

Alouette II in Venice

Welcome:
    Enter the helicopter through the right door(E), close the door, start the Engine (E), 
    -Fly the slalom - try to beat your own time, (the next way point is also indicated by the Heli instruments.)
        Your flight will be recorded and played back the next time you fly the slalom: You can see how you flew.
        You can turn off the Slalom recorder by setting the property 'slalom_recorder' of the object 'ZSE' to false.
    The helicopter will consume Fuel. Refuel on the Helipads.
    Exiting the helicopter is only possible with stopped Engine (E).

Default is Joystick for the helicopter.
You can use the mouse instead for the Aircraft unplugging all joysticks or by setting
'Controller-Joystick' to None in Joystick Menu (key J)
In this menu you can also choose a 'Tracking-Joystick' for HeadTracking in Cockpit view
More info about Joysticks down below.


Joystick Assignment:
    Key J:  Open/Close Menu
            On Top choose Controller-Joystick with LeftMouseClick
            Left Mouse Button:  enable/disable listening, then move Axis to full extend or press Button 
            Right Mouse Button: delete Entry
            
            Axes Sensitivity: MouseWheel up/down. LeftClick to reset to 100.
            
            You can test buttons and Axes:  assigned function will highlight in pink 
            
            On Bottom Choose HeadTracking-Joystick with LeftMouseClick   
                     
            When Menu is closed the settings are saved to disk ('name'.bgeconf)
            
            
View:     
    Key F or JoyButton 7: Fly-by Camera
            Or when in FirstPerson-Modus switch back to FirstPerson-View (from Ground-Camera)
            (CTRL+)MouseWheel or PgUp/PgDown or JoyButton 3/4: Zoom
            (CTRL+)Mouse or Arrow Keys or JoyHat: rotate Camera
            MiddleMouseButton or JoyButton 2: From Top-View            
           
                
    Key G: Ground Camera
            hit G again to switch between 4 different Views 
            SHIFT+G previous View
            
    Key H or JoyButton 8: Helicopter Cockpit Camera
            (CTRL+)MouseWheel or PgUp/PgDown or JoyButton 3/4: Zoom
            (CTRL+)Mouse or Arrow Keys or JoyHat: Look around  (if Tracker-Joystick is enabled then it will rotate view)
            MiddleMouseButton or JoyButton 2: Center View
            
    
    ENTER key: restart scene
    
Controls:       
        
    Helicopter:
        Controls:
        E or JoyButton 5: start/stop Rotor-Engine
        W/S or JoyThrottle: main Rotor Collective pitch 
        A/D or JoyZ-Axis: tail rotor left/right
        Mouse or Joy-Axes: main Rotor cyclic control                                      
        Q or JoyButton 6: Auto-Stabilizer On/Off   
        
        Space or JoyButton 1: Toggle Follow mode in Flyby view (if Tracker-Joystick enabled then it will rotate view)
                
    FirstPerson-View:
        Controls:
        Mouse: View
        W/A/S/D: Move
        Shift: Run
        Space: Jump
        
        E or JoyButton 5: Open/Close Helicopter Door 
           Enter/Exit Helicopter
           Start/Stop Helicopter Engine
           
Manual recorder:
    Key O: start recording
    Key P: (stop recording and) playback recording
    
Debug shortcut keys:
    Key 1: 1st person View
    Key 2: Focus on Alouette
    Key 3: Focus on Alouette Dummy  (useful when playing back manual recording)
                          
Visualization of Forces:
    set the properties of object 'ZSE'
        show_heli_force
    to True or False
    
Sensibility of Helicopter Controls with mouse:
    set the properties of object 'Alouette'

    
About Controller-Joystick:
For a Microsoft SideWinder Force Feedback 2 to be recognized by Blender add this SDL2 code:
030000005e0400001b00000000000000,SideWinder Force Feedback 2 Joystick,platform:Windows,a:b7,b:b4,x:b6,y:b5,leftshoulder:b2,rightshoulder:b3,leftstick:b0,rightstick:b1,leftx:a2,lefty:a3,rightx:a0,righty:a1,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,
to the file:
UPBGE-0.30-windows-x86_64->3.0->datafiles->gamecontroller->gamecontrollerdb.txt

Or for your joystick create a SDL2 code with one of these Tools:
    https://generalarcade.com/gamepadtool/
    https://github.com/AntiMicroX/antimicrox
and edit your joystick Axes and Buttons in the Joystick Menu (Key J)
    
About HeadTracking-Joystick:
Setup your favorite HeadTracking software (TrackIR, OpenTrack, FreeTrack, LinuxTrack) to output to a virtual Joystick (vJoy, PPJoy). And set 'Center-Button' to the same as in this game (Joystick-Button 2)
E.g. on Windows you can use TrackIR->FreePie->vJoy. For FreePie the Python script from here is used:
https://www.avsim.com/forums/topic/497411-workaround-trackir-chaseplane-vjoy-freepie/
I use my TrackIR3 Device with Freetrack->FreePie->vJoy with another script.
You can find a copy of both scripts for FreePie in this blend here.
    
    
Credits:
Airport and helicopter sound by SHINN THANT
https://blendswap.com/blend/15976

Venice
https://downloadfree3d.com/3d-models/architecture/building/venice/
Non-commercial license, free for personal use

Helicopter model by Helijah
SNCASE SE.3130 Alouette II  by Helijah
https://blendswap.com/blend/27593
License: CC-BY

Venice Background music by YOH (edited)
https://freesound.org/people/YOH/sounds/169535/
CC BY 4.0

Sounds:
    https://www.pacdv.com/sounds/
    https://freesound.org
1 Like

Engineering + BGE= Always Cool Stuff

1 Like

Man! This is cool. A lot of progress and it’s looking fantastic.

1 Like

it’s a pity that joysticks are not supported out of the box in UPBGE because the used SDL2 library only supports gamepads and the gamecontroller-database providers reject any joysticks to be added to their database.
So if you want to fly this heli with your joystick (very recommended!!!) you have to create your own controller mapping and add it to the UPBGE gamecontrollerdb.txt as described in my “welcome-texts” above.

1 Like

Both Alouette II demos now have responsive physics even with low fps.
No more Physics slowdown due to low fps by setting the LogicTicRate.

The compensation of lower fps sets LogicTicRate to the Average FrameRate, calculates Delta-time and multiplies all Movements of static objects like Camera with it.
Physics and animations don’t need to be multiplied with Delta-Time.
This is the code:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

# give 60 frames time to get a reliable AverageFrameRate
if "AVRskip" not in own:
    own['AVRskip']=60

own["AVR"]=bge.logic.getAverageFrameRate()
if own['AVRskip']<0 and own["AVR"]>0:
    bge.logic.deltaTime=1/own["AVR"]
else:
    bge.logic.deltaTime=1/60
        
if own["AVR"]<=0.0: own["AVR"]=60

if own['AVRskip']<0 and  0<own["AVR"] < 60: 
    bge.logic.setLogicTicRate(own["AVR"]+1)

own['AVRskip']-=1

As reference Framerate I use 60 fps so deltatime can be applied like eg.:
Camera.applyRotation(CamVec*bge.logic.deltaTime*60,True)

Also “Slow Parent”-Values and special Constraint-settings need to be multiplied with it eg.:
AlouetteCam.timeOffset=0.3/(bge.logic.deltaTime*60)
bge.constraints.setNumTimeSubSteps(int(5*bge.logic.deltaTime*60))

Otherwise the Rotor-Blades will fly away :slight_smile:
Happy Flying!!!

1 Like

gamecontrollerdb.txt
with Microsoft Sidewinder Force Feedback 2 joystick
for Windows and Linux
and virtual opentrack joystick for Linux
as well as virtual linuxtrack joystick for Linux
gamecontrollerdb.txt (492.9 KB)

1 Like

Wow, OpenTrack has builtin headtracker that works with any webcam.
So simple: output to virtual Joystick vJoy.
In my UPBGE simulators just select vJoy for Headtracker-input.

Tested it on Windows before I try to compile OpenTrack on Linux.

LINUX:
Found appimage here (thanks so much to wheaney !!!):

For output to virtual Joystick enable rights to write to ‘/dev/uinput’:
sudo chmod +0666 /dev/uinput

UPBGE needs entry in gamecontrollerdb.txt like:
03000000ac070000362500007b000000,opentrack,a:b0,b:b1,back:b15,dpdown:b6,dpleft:b7,dpright:b8,dpup:b5,guide:b16,leftshoulder:b9,leftstick:b13,lefttrigger:b11,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b14,righttrigger:b12,rightx:a3,righty:a4,start:b4,x:b2,y:b3,platform:Linux,

or use the file from previous post.

To make non-gamepads work in UPBGE get the GUID from tools like
gamepad-tool or Antimicrox.
The trick to make it recognized by UPBGE is to change numbers 5-8 to 0.
From
030043cf5e0400001b00000000010000
to
030000005e0400001b00000000010000

----------- Alternative: TrackIR on Linux with LinuxTrack-------------
Now I also tested my old TrackIR device on Linux and it works like a charm!!
It’s also much easier on Linux than on Windows.
Get the LinuxTrack appimage here.

To use the virtual Joystick in UPBGE I added this to gamecontrollerdb.txt:
060000004c696e7578547261636b2000,linuxtrack,a:b0,b:b1,back:b15,dpdown:b6,dpleft:b7,dpright:b8,dpup:b5,guide:b16,leftshoulder:b9,leftstick:b13,lefttrigger:b11,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b14,righttrigger:b12,rightx:a3,righty:a4,start:b4,x:b2,y:b3,platform:Linux,

5 Likes