Advertisement
CapsAdmin

Untitled

Feb 21st, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.35 KB | None | 0 0
  1. hook.Add("CalcView", "dynamic znear", function(ply, pos, ang, fov, znear, zfar)
  2.     local d = util.TraceLine(
  3.         {
  4.             start = pos,
  5.             endpos = pos + ang:Forward() * 20,
  6.             filter = ply
  7.         }
  8.     )
  9.    
  10.     fov = -(fov / 180) + 1
  11.                
  12.     local z = d.Fraction * fov
  13.     z = z * 20     
  14.        
  15.     if z < 1 then
  16.         z = znear
  17.     end
  18.                
  19.     return
  20.     {
  21.         znear = z
  22.     }
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement