Python1320

CapsAdmin

Mar 4th, 2011
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. local angle_origin, vector_origin = Angle(0,0,0), vector_origin
  2. local offset = Vector(4,0,0)
  3. hook.Add("PlayerBuildBonePositions", "side_lean", function(ply, bones)
  4.     local vel_world = ply:GetVelocity() vel_world.z = 0
  5.     local vel = WorldToLocal(vel_world, angle_origin, vector_origin, ply:EyeAngles())
  6.    
  7.     vel.y = math.Clamp(vel.y, -150, 150)
  8.    
  9.     ply.smooth = (ply.smooth or 0) + ((vel.y - (ply.smooth or 0)) * FrameTime() * 10)
  10.     local pos, ang = ply:GetBonePosition(ply:LookupBone(BONE_PELVIS))
  11.     local side = ply.smooth * -0.121
  12.     ply:SetBonePosition(ply:LookupBone(BONE_PELVIS), pos + Vector(0,0,-math.abs(side*0.05)), ang + Angle(side, 0, 0))
  13. end)
  14.  
  15. hook.Add("UpdateAnimation", "breathe_fix", function(ply)
  16.     if ply:KeyDown(IN_RUN) then ply.breathing_run = math.Clamp((ply.breathing_run or 0) + 1, 0, 50) end
  17.     ply:SetPoseParameter("breathing", ply.breathing)
  18.     ply.breathing_run= math.Clamp((ply.breathing_runor or 0) - (not ply:KeyDown(IN_RUN) and 1), 0, 50)
  19. end)
Add Comment
Please, Sign In to add comment