Easiest way to get the player's left and right (clientside)
3 replies, posted
Hello,
I'm working on a smooth camera effect. How would I get the player's movement from left and right (even if they're not facing a certain degree)?
Thanks.
movement in what aspect
when they press A and D.
also, I've got some code for my smooth camera, however the view model and the WASD movement isn't synchronized with it. It's modified via calcview.
[code]
local _Mx = 0;
local _My = 0;
hook.Add( "CreateMove", "SWEP:GetValues", function( _cmd )
local _p = LocalPlayer( ); -- for player
_Mx = _Mx + -_cmd:GetMouseX( )/64;
_My = math.Clamp(_My + _cmd:GetMouseY( )/32, -90, 90);
end );
function SmoothCam(ply, pos, angles, fov)
local view = {}
view.origin = pos
view.angles = Angle(_My, _Mx, 0);
view.fov = fov
return view
end
hook.Add("CalcView", "SmoothCamera", SmoothCam)
[/code]
[editline]9th July 2014[/editline]
Is there some way/place I can directly modify the X and Y movement of the mouse that goes into the game view?