local N = require "scriptbank\\Cine Guru\\cg_pnoise" local max = math.max local min = math.min local rad = math.rad local deg = math.deg local random = math.random math.randomseed(os.time()) random(); random(); random() local trauma = 0.2 local period = 550 local lastShakeTime = 0 local seed1, seed2, seed3 = random() * 1000, random() * 1000, random() * 1000 local maxPitch = 5 local maxYaw = 20 local maxRoll = 5 local function AddShake( xA, yA, zA, timeNow ) -- trauma fade over time if trauma > 0 then if timeNow - lastShakeTime > 2000 then seed1 = random() * 1000 seed2 = random() * 1000 seed3 = random() * 1000 end lastShakeTime = timeNow local shake = trauma^2 local t = timeNow / period xA = xA + maxPitch * shake * N.PNoise( t, seed1 ) yA = yA + maxYaw * shake * N.PNoise( t, seed2 ) zA = zA + maxRoll * shake * N.PNoise( t, seed3 ) end return xA, yA, zA end local gpcOverride = false local orig_gpc = nil local function gpcControl() orig_gpc() if ( GetGamePlayerControlThirdpersonEnabled() == 0 ) then local angx = GetCameraAngleX(0) local angy = GetCameraAngleY(0) local angz = GetCameraAngleZ(0) angx, angy, angz = AddShake( angx, angy, angz, g_Time ) SetCameraAngle( 0, angx, angy, angz ) end end function player_wobble_init() end function player_wobble_main() if not gpcOverride and gameplayercontrol ~= nil then orig_gpc = gameplayercontrol.control gameplayercontrol.control = gpcControl gpcOverride = true end end