Running effect.

I’m trying to create a more realistic running effect where your screen tilts a bit to the left and right when you run, as well as motion blur. I have been unable to find out how to do this. Any help would be much appreciated.

How familiar are you with lua? Because if you already know lua and a good portion of math, i would just throw this link at you:

Dunno how you would manually create motionblur in lua, i’m not that familiar with all the render stuff

[editline]18th November 2011[/editline]

Oh and next time post in Lua scripting > Requests or Questions please

Thanks, I’ve gotten this…


function MyCalcView(ply, pos, angles, fov)
    local view = {}
	local Time = RealTime()*3.5;
	local Roll = math.sin(Time)*5;
	local Pitch = math.sin(Time/4)*7;
    view.origin = pos-(angles:Forward()*50)
    view.angles = angles+Angle(Pitch,0,Roll);
    view.fov = fov;
    return view;
end
hook.Add("CalcView", "MyCalcView", MyCalcView)
hook.Add("ShouldDrawLocalPlayer", "MyHax ShouldDrawLocalPlayer", function(ply)
    return true
end)

Which works alright, probaply not the best effect you’ll see. I just need to know how to make the view first person instead the thirdperson effect.

Remove the ShouldDrawLocalPlayer hook.

Thanks Chessnut, only issue i’m having now is checking if the player is sprinting… oddly enough I can’t find it on the lua wiki.

Then make it so if IN_SPEED is pressed, enable a variable that allows the effect to run.