Benny/gamemodes/benny/gamemode/camera.lua

35 lines
726 B
Lua
Raw Normal View History

2024-03-07 20:34:16 -05:00
---------------------
-- Your Name is Benny
---------------------
2024-03-07 21:19:30 -05:00
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 )
2024-03-07 22:34:29 -05:00
local m = 3
2024-03-07 21:19:30 -05:00
local m2 = Vector( m, m, m )
local m1 = m2:GetNegated()
2024-03-07 20:34:16 -05:00
function GM:CalcView( ply, pos, ang, fov )
2024-03-07 21:19:30 -05:00
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)
2024-03-07 20:34:16 -05:00
local view = {
2024-03-07 21:19:30 -05:00
origin = tr.HitPos,
2024-03-07 20:34:16 -05:00
angles = angles,
2024-03-07 21:19:30 -05:00
fov = cam_fov:GetFloat(),
2024-03-07 20:34:16 -05:00
drawviewer = true
}
2024-03-07 21:19:30 -05:00
2024-03-07 20:34:16 -05:00
return view
end