multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 428 forks source link

setAircraftMaxVelocity causes plane to gain unwanted altitude #709

Open mtadayz opened 5 years ago

mtadayz commented 5 years ago

Describe the bug Basically, what the title says. Using setAircraftMaxVelocity with any value above 1.4 causes your plane to unexpectedly gain altitude by pitching up. I don't know how to word that peculiar bug in more precise terms, I guess it must be seen to understand that one.

To reproduce

function spawnVehSetInvincible()
    setAircraftMaxHeight(5000)
    setAircraftMaxVelocity(10) -- Values > 1.4 cause planes to "rotate" up on the X axis
    local hydra = createVehicle(520,0,0,3000)
    setVehicleDamageProof(hydra,true)
    setTimer(warpPedIntoVehicle,3000,1,getPlayerFromName("L"),hydra) 
end
addEventHandler("onResourceStart",resourceRoot,spawnVehSetInvincible)

Please note that "getPlayerFromName" is used for debug purposes. You'll have to substitute "L" for your own name. The code is serverside. Once you're inside the Hydra, level it and start flying around without moving up or down. You'll notice that for some reason, the Hydra is pitching up.

Expected behaviour I thought using that function would simply allow planes to be faster, nothing more.

Version

Einheit-101 commented 5 years ago

i guess this is because of GTA aerodynamics. Planes simply dont fly straight forward, they gain/lose altitude depending on their speed. In real life we can trim the rudders to counter this effect but in MTA you have to script that yourself. This "lift" should even exist as vehicle handling, but unfortunately its currently impossible to edit plane vehicle handling.

mtadayz commented 5 years ago

Makes me wonder why you can't edit boat/bike/heli/plane handling...I'd love to, honestly. Anyway, the whole thing is kinda weird, as using 1.15 as a value does not produce such behaviour. I'd have to test and see if this bug happens in regular GTA, or if it's really MTA-related.

EDIT: Can confirm this happens in regular GTA. Does this mean the bug mentioned above isn't one and just a result of GTA aerodynamics...? Bummer. Any way to counter that effect?