Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ****************************************************************
- ; Sliding factor.
- ; Created by: Dead3yez
- ; ****************************************************************
- _veh = _this select 0
- _handlin = _this select 1
- #start
- ;speed and height required
- _h = getposatl _veh select 2
- _s = speed _veh
- if ((_h < 1) and (_s > 10))then {goto "checkveldir"}
- ~0.01
- goto "start"
- #checkveldir
- ; To return vector direcion: atan ( y / x )
- _velx = velocity _veh select 0
- _vely = velocity _veh select 1
- _velz = velocity _veh select 2
- _veldir = _velx atan2 _vely
- ; point to correct calculation, for return value 0 - 360
- _vehdir = getdir _veh
- if ((_veldir > -180) and (_veldir < 0)) then {goto "calc1"} else {goto "calc2"}
- ~0.01
- goto "start"
- ; calculations to return value 0 - 360, not 0 - -180 or 0 - 180
- #calc1
- _velact = 360 + _veldir
- goto "calcdif"
- #calc2
- _velact = _veldir
- goto "calcdif"
- #calcdif
- ; To prevent values over 360 and under 0, to calculate correct distance
- If (_velact < _vehdir) then {goto "difis1"}
- if (_velact > _vehdir) then {goto "difis2"}
- ~0.01
- goto "start"
- #difis1
- _dif = _vehdir - _velact
- #difis2
- _dif = (360 + _velact) - _vehdir
- ; when vector angle difference to vehicle direction is greater than set value, ~75 is good value
- if ((_dif >= 361) and (_dif <= 450)) then {goto "changevec"}
- if ((_dif <= 359) and (_dif >= 270)) then {goto "changevec"}
- if ((_dif <= 89) and (_dif >= 0)) then {goto "changevec"}
- ~0.01
- goto "start"
- #changevec
- ; hint format[" %1 \n %2 \n %3 \n %4", _veldir, _vehdir, _velact, _dif]
- ; change vector depending on speed, vel dir and veh dir
- _vx = sin _veldir
- _vy = cos _veldir
- _hx = sin _vehdir
- _hy = cos _vehdir
- _factx = _vx - _hx
- _facty = _vy - _hy
- _dec = -_s / _handlin
- if (_s > 0) then {_veh setvelocity [_velx + (_factx * _dec), _vely + (_facty * _dec), _velz]}
- ; if (_s > 35) then {goto "flip"} (isnotfinished)
- ~0.01
- goto "start"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement