Gamemode.CalcView

From GMod Wiki

Revision as of 11:43, 27 December 2010 by Zoey Artyom (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameCalcView
SyntaxGM:CalcView( Player player, Vector origin, Angle angles, Float fov )
DescriptionAllows override of the default view.
ReturnsTable
Lua StateNewerClient.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.CalcView]Gamemode.CalcView [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionDraws the LocalPlayer and sets the view behind.
Used onNewerClient.png
Code
function MyCalcView(ply, pos, angles, fov)
    local view = {}
    view.origin = pos-(angles:Forward()*100)
    view.angles = angles
    view.fov = fov
 
    return view
end
 
hook.Add("CalcView", "MyCalcView", MyCalcView)
 
hook.Add("ShouldDrawLocalPlayer", "MyHax ShouldDrawLocalPlayer", function(ply)
        return true
end)
 
OutputN/A


Additional Notes

function MyCalcView(ply,origin,angles,fov)
       //Do your stuff -- Example: local view = GAMEMODE:CalcView(ply,origin,angles,fov)
 
       //return the modified values
       //if in a gamemode do
       //return self.BaseClass:CalcView(ply,origin,angles,fov)
end
function MyCalcView(ply,origin,angles,fov)
       //Do your stuff
 
       //return the modified values
       return GAMEMODE:CalcView(ply,origin,angles,fov)
       //if in a gamemode do
       //return self.BaseClass:CalcView(ply,origin,angles,fov)
end
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox