Created
May 22, 2015 13:35
-
-
Save StrixG/bdc299b939dbbd455795 to your computer and use it in GitHub Desktop.
Drift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stock GetVehicleDriftAngle(vehicleid, &Float:fVehDriftAngle) | |
{ | |
new | |
Float: fVehVelocity[3], | |
Float: fVehAngle, | |
Float: fVehMoveAngle; | |
if (!GetVehicleVelocity(vehicleid, fVehVelocity[0], fVehVelocity[1], fVehVelocity[2])) | |
{ | |
return 0; | |
} | |
if (fVehVelocity[0] == 0.0 && fVehVelocity[1] == 0.0) | |
{ | |
fVehDriftAngle = 0.0; | |
return 1; | |
} | |
fVehMoveAngle = -atan2(fVehVelocity[0], fVehVelocity[1]); | |
GetVehicleZAngle(vehicleid, fVehAngle); | |
if (fVehAngle > 180.0) | |
{ | |
fVehAngle -= 360.0; | |
} | |
fVehDriftAngle = fVehMoveAngle - fVehAngle; | |
if (fVehDriftAngle < -180.0) | |
{ | |
fVehDriftAngle += 360.0; | |
} | |
else if (fVehDriftAngle > 180.0) | |
{ | |
fVehDriftAngle -= 360.0; | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment