Re: Air Manager- Aiguilles vibrantes
Posté: Lun 28 Aoû 2017 18:50
Avec toutes ces aiguilles qui bougent, je pense qu'il serait plus judicieux de faire vibrer le siège ou le tableau de bord
Echange et partage entre créateurs et réalisateurs de simulateurs de vol.
https://aircockpit.com/
arcc a écrit:Merci Jacques
J'en ai mise une juste au dessus dans mon message.
A+
Christian
-- Only for DHC6 Twin Otter Extended by Aerosoft --
-- Torque Pressure Gauge Left Version 3 --
-- By Christian R (arcc) --
-- CUSTOMIZATION VARIABLES ------
-- sample Values for a modern single engine (Cessna, Piper, Robin)
frequency=30 -- increase the 40 value to slow down the overall vibrations for "slow running" engines (up to 100 max)
vibmax=80 --beginning of max vibrations in %power
valmax=0.15 -- range of max vibration values
vibmid=30 --beginning of medium vibrations in %power
valmid=0.35
viblow=0.25 -- low idle
vallow=0.22
-- sample Values for a WWI Fighter
-- frequency=60 -- increase the 40 value to slow down the overall vibrations for "slow running" engines (up to 100 max)
-- vibmax=90 --beginning of max vibrations in %power
-- valmax=0.5 -- range of max vibration values
-- vibmid=30 --beginning of medium vibrations in %power
-- valmid=1
-- viblow=0.25 -- low idle
-- vallow=2
-- sample values for a WW1 Fighter
-- frequency=70 -- increase the 40 value to slow down the overall vibrations for "slow running" engines (up to 100 max)
-- vibmax=75 --beginning of max vibrations in %power
-- valmax=4 -- range of max vibration values
-- vibmid=40 --beginning of medium vibrations in %power
-- valmid=2.5
-- viblow=0.1 --low idle
-- vallow=3.5
----------------------------------------------
local needleairspeed=0
local rand=1
local val=0
local vibrationlvl=0
-- Global variables Torque Pressure Left --
local trqpress1 = 0
local target_trqpress1 = 0
local factor = 0.05
local max_trqpress1 = 75
-- Images --
img_add_fullscreen("torque_left_backdrop_day.png")
img_needle = img_add_fullscreen("needle.png")
img_add_fullscreen("cache.png")
mask_day = img_add_fullscreen("mask_day.png")
mask_light = img_add_fullscreen("mask_light.png")
mask_night = img_add_fullscreen("mask_night.png")
mask_dusk = img_add_fullscreen("mask_dusk.png")
--choix d'image en fontion de l'eclairage--
function new_light_FSX(light,ambiance,master)
lighted=light and master
img_visible(mask_light, lighted)
img_visible(mask_night, lighted == false and ambiance== 3)
img_visible(mask_dusk, lighted == false and ambiance== 2)
img_visible(mask_day, ambiance == 1)
end
-- Function for Torque Pressure --
function Var_Eng1PSI(trqpress1)
target_trqpress1 = var_cap(trqpress1, 0, max_trqpress1)
end
-- Slowly move needle --
function timer_callback()
trqpress1 = trqpress1 + ((target_trqpress1 - trqpress1) * factor)
------------- AJOUT JZ ----------------
-- img-rotate déplacée dans la fonction de vibration
end
----------------------------- AJOUT JZ ---------------------
---------- Gestion des vibrations aiguille
function vibrate(soundrpm)
if soundrpm<0.1 then
vibrationlvl=0
else
vibrationlvl=soundrpm
end
end
function vibration_callback() -- function called every 40 mseconds,
rand=-rand -- offset value of the needle, alternatively to the left or to the right
--setting up of the amplitude of vibrations depending of the % of sound produced, since engien vibration is not reliable (Change val values to taste!)
if vibrationlvl>vibmax then -- high rpm, small amplitude
val=valmax
elseif vibrationlvl>vibmid then -- medium range rpm, larger amplitude of needle movements
val=valmid
elseif vibrationlvl>viblow then --slow rpm, smaller amplitude of needle movements
val=vallow
else -- engine stopped, no needle movements
val=0
end
-- AJOUT JZ ----
-- on calcule needlepo d'après trqpress1
needlepos=trqpress1+(rand*val) -- calculation of the needle movement
-- routine de rotation aiguille deplacee ici
img_rotate(img_needle, 264/75 * (needlepos) + 6)
end
timer_start(0,frequency,vibration_callback)
fsx_variable_subscribe("GENERAL ENG COMBUSTION SOUND PERCENT:1","percent",vibrate)
--------------- FIN AJOUT JZ
--Images--
img_add_fullscreen("glass.png") -- Without glass insert two - at the beginning of the line
-- FSX Variables --
fsx_variable_subscribe("L:DHC6_Eng1_PSI", "", Var_Eng1PSI) -- Twin Otter Extended Variable
fsx_variable_subscribe("LIGHT PANEL","Bool",
"TIME OF DAY", "Enum",
"ELECTRICAL MASTER BATTERY", "Bool", new_light_FSX) -- FSX Variables night light
-- Timers --
tmr_update = timer_start(0, 60, timer_callback)
---