Python1320

better arms

Oct 10th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. local up=Vector(0,0,1)
  2. function GM:UpdateAnimation( ply, velocity, maxseqgroundspeed )
  3.  
  4.     local len = velocity:Length()
  5.     local movement = 1.0
  6.    
  7.     if ( len > 0.2 ) then
  8.             movement =  ( len / maxseqgroundspeed )
  9.     end
  10.    
  11.     rate = math.min( movement, 2 )
  12.  
  13.     // if we're under water we want to constantly be swimming..
  14.     if ( ply:WaterLevel() >= 2 ) then
  15.         rate = math.max( rate * 0.1, 0.1 )
  16.     elseif ( ply:GetMoveType() == MOVETYPE_NOCLIP ) then
  17.         rate = len * 0.00001;
  18.     elseif ( !ply:IsOnGround() && len >= 1000 ) then
  19.         rate = 0.1;
  20.     end
  21.    
  22.     ply:SetPlaybackRate( rate )
  23.  
  24.  
  25.  
  26.    
  27.     if ( ply:InVehicle() ) then
  28.         local Vehicle =  ply:GetVehicle()
  29.        
  30.         // We only need to do this clientside..
  31.         if ( CLIENT ) then
  32.             //
  33.             // This is used for the 'rollercoaster' arms
  34.             //
  35.             local Velocity = Vehicle:GetVelocity()
  36.                        local fwd=Vehicle:GetUp()                      
  37.                        local dp= fwd:Dot(up)
  38.                        local dp2=fwd:Dot(Velocity)
  39.             ply:SetPoseParameter( "vertical_velocity", (dp<0 and dp or 0)+dp2*0.005 )
  40.  
  41.             // Pass the vehicles steer param down to the player
  42.             local steer = Vehicle:GetPoseParameter( "vehicle_steer" )
  43.             steer = steer * 2 - 1 // convert from 0..1 to -1..1
  44.             ply:SetPoseParameter( "vehicle_steer", steer  )
  45.         end
  46.        
  47.     end
  48.    
  49.     if ( CLIENT ) then
  50.         GAMEMODE:GrabEarAnimation( ply )
  51.     end
  52.    
  53. end
  54.  
Advertisement
Add Comment
Please, Sign In to add comment