Benny/gamemodes/benny/gamemode/camera.lua

35 lines
726 B
Lua

---------------------
-- Your Name is Benny
---------------------
local cam_f = CreateConVar( "b-cam_f", -40 )
local cam_r = CreateConVar( "b-cam_r", 12 )
local cam_u = CreateConVar( "b-cam_u", 0 )
local cam_fov = CreateConVar( "b-cam_fov", 75 )
local m = 3
local m2 = Vector( m, m, m )
local m1 = m2:GetNegated()
function GM:CalcView( ply, pos, ang, fov )
local f, r, u = ang:Forward(), ang:Right(), ang:Up()
local tr = {
start = pos,
endpos = pos + (f*cam_f:GetFloat()) + (r*cam_r:GetFloat()) + (u*cam_u:GetFloat()),
filter = ply,
mins = m1,
maxs = m2,
}
tr = util.TraceHull(tr)
local view = {
origin = tr.HitPos,
angles = angles,
fov = cam_fov:GetFloat(),
drawviewer = true
}
return view
end