How do I "lock" the players view? Or how can I change it?
7 replies, posted
I mean, how do I lock it so, for example, the player cant lock behind.
And the change it I mean, how to make it look, for example 90 degres to his left-
Thanks!
[QUOTE=Netheous;43839147][url]http://wiki.garrysmod.com/page/Player/SetViewOffset[/url][/QUOTE]
How do I use it?
The wiki page is pretty straight forward..
Play around with it on a player, it's a pretty simple function.
Just experiment with different vectors.
And how do I change the way a player is looking?
You put a vector in the function and it offsets their view.
[code]
ply:SetViewOffset( Vector( 25, 25, 25 ) )
[/code]
[QUOTE=Jeezy;43839296]You put a vector in the function and it offsets their view.
[code]
ply:SetViewOffset( Vector( 25, 25, 25 ) )
[/code][/QUOTE]
It doesn't change anything. I'm pretty bad a this things
It depends what you mean by setting the view.
If you want to change the players view-position: ply:SetViewOffset
If you want to change the players view-angle: ply:SetEyeAngles
If you want to dodo something complicated: [url]http://wiki.garrysmod.com/page/GM/CalcView[/url]
[lua]
function MyCalcView( ply, pos, angles, fov )
local view = {}
view.origin = pos -- Position of the view
view.angles = angles -- angle of the view
view.fov = fov -- fov of the view
return view
end
hook.Add( "CalcView", "MyCalcView", MyCalcView )
[/lua]
Sorry, you need to Log In to post a reply to this thread.