function camera_control_init(e) end local mod = math.modf local distspeed = 0.2 local heightspeed = 0.3 local zoom, zooming, oldzooming, czdist, czheight = 0, 0, nil, 0, 0 local ttx, tty, ttz, tax, tay, taz, tda, tcamdist, tcamheight, tfx, tfy, tfz function camera_control_main(e) if oldzooming == nil then oldzooming = g_MouseWheel end zooming = oldzooming - g_MouseWheel oldzooming = g_MouseWheel if zooming ~= 0 then ttx=GetPlrObjectPositionX() tty=GetPlrObjectPositionY()-35.0 ttz=GetPlrObjectPositionZ() czdist = czdist + (zooming * distspeed) czheight = czheight + (zooming * heightspeed) --Prompt(czdist.." , "..czheight) tcamdist=GetGamePlayerControlThirdpersonCameraDistance() + czdist tcamheight=GetGamePlayerControlThirdpersonCameraHeight() + czheight tda=WrapValue(180-(0-GetCameraAngleY(0))) tax=(math.sin(math.rad(tda))*tcamdist) tfx=ttx+tax tay=tcamheight tfy=tty+tay taz=(math.cos(math.rad(tda))*tcamdist) tfz=ttz+taz else if g_KeyPressE == 1 then if zoom == 0 then ttx=GetPlrObjectPositionX() tty=GetPlrObjectPositionY()-35.0 ttz=GetPlrObjectPositionZ() tcamdist=GetGamePlayerControlThirdpersonCameraDistance() + 20 tcamheight=GetGamePlayerControlThirdpersonCameraHeight() + 40 tda=WrapValue(180-(0-GetCameraAngleY(0))) tax=(math.sin(math.rad(tda))*tcamdist) tfx=ttx+tax tay=tcamheight tfy=tty+tay taz=(math.cos(math.rad(tda))*tcamdist) tfz=ttz+taz zoom = 1 end elseif zoom == 1 then zoom = 0 SetCameraOverride(zoom) end end if zoom == 1 or zooming ~= 0 then SetCameraOverride(1) PositionCamera ( 0,tfx,tfy,tfz ) PointCamera ( 0,ttx,tty,ttz ) end end