When I was playing PAYDAY: The Heist I noticed that even if you're standing still the camera slightly moves, so it emulates breathing. I thought it was really neat since it didn't make the game look dead if you didn't move your mouse and stared at some part of the map.
I was wondering whether it would be possible, and if possible, to put in Garrysmod: a subtle camera movement that emulates breathing. If it was toggle-able that'd be even better. It would make the game seem more lively instead of frozen if you don't move the mouse, just a nice subtle touch.
If anyone could get back on this, I'd appreciate it!
this is a rather easy effect to make.
[lua]
hook.Add("Think", "PlayerBreathing", function()
if (!LocalPlayer().HeadMovement) then return; end
local ang = EyeAngles();
local add = math.sin(CurTime());
LocalPlayer():SetEyeAngles( Angle(ang.p + add / 15, ang.y, ang.r) );
end)
[/lua]
this will create a nice relatively realistic slow up/down head movement, and it doesnt move too much.
if its too fast, increase the / 20, if its too slow decrease it. but be warned that the more you increase it, the less the camera will move up and down. the more you decrease it the more it will move up and down.
if you want it to go more than up and down heres how it will work:
[lua]
Angle(up/down, pan left/right, tilt left/right)
[/lua]
enjoy :)
[editline]31st July 2012[/editline]
i just realised that with that when you fall from a height and you get the view punch, the camera sticks and its tiled, ill try and work on it :D
[editline]31st July 2012[/editline]
ok i got it heres the new code:
[lua]
hook.Add("Think", "PlayerBreathing", function()
if (!LocalPlayer().HeadMovement) then return; end
local ang = EyeAngles();
local add = math.sin(CurTime());
local newang = ang + Angle(add / 15, 0, 0);
LocalPlayer():SetEyeAngles( newang );
if (EyeAngles().r != 0) then
ang = EyeAngles();
LocalPlayer():SetEyeAngles( Angle(ang.p, ang.y, math.Approach(ang.r, 0, 1)) );
end
end)
[/lua]
Would that go in lua/autorun, lua/autorun/client, or lua/autorun/server ? I tried all 3 and there was no effect for me
There was an addon, SharpYe, that did this pretty well.
[QUOTE=James xX;37032537]There was an addon, SharpYe, that did this pretty well.[/QUOTE]
Is there anyway to increase the idle breathing effect? In terms of speed or distance in bobbing? Without effecting the entire set-up though, just standing still. At the moment its unnoticeable unless you stand right next to something, but thanks.
[QUOTE=t h e;37037815]Is there anyway to increase the idle breathing effect? In terms of speed or distance in bobbing? Without effecting the entire set-up though, just standing still. At the moment its unnoticeable unless you stand right next to something, but thanks.[/QUOTE]
At the code, do you see a "/ 15"?
decrease that 15, the more you decrease it the more it will move up and down.
[QUOTE=Stillnex;37037945]At the code, do you see a "/ 15"?
decrease that 15, the more you decrease it the more it will move up and down.[/QUOTE]
I can't seem to find / 15 anywhere
ye i just said that stillnex and yes its a client side file so autorun/client
[QUOTE=G4MB!T;37039162]ye i just said that stillnex and yes its a client side file so autorun/client[/QUOTE]
I know, I even copied it from your post, but as he apparently didn't see what you posted, I helped him.
haha fair enough stillnex :P
[QUOTE=t h e;37039124]I can't seem to find / 15 anywhere[/QUOTE]
good god, here
local newang = ang + Angle(add / 15, 0, 0);
[QUOTE=Stillnex;37037945]At the code, do you see a "/ 15"?
decrease that 15, the more you decrease it the more it will move up and down.[/QUOTE]
Oh, I thought you were speaking about SharpeYe. Sorry about that.
[editline]1st August 2012[/editline]
[QUOTE=G4MB!T;37039884]haha fair enough stillnex :P
good god, here
local newang = ang + Angle(add / 15, 0, 0);[/QUOTE]
Thanks, I like it. Appreciate it man.
Sorry, you need to Log In to post a reply to this thread.