Code |
/*---------------------------------------------------------
Name: gamemode:UpdateAnimation( )
Desc: Animation updates (pose params etc) should be done here
---------------------------------------------------------*/
function GM:UpdateAnimation( ply, velocity, maxseqgroundspeed )
local len2d = velocity:Length2D()
local rate = 1.0
if len2d > 0.5 then
rate = ( len2d / maxseqgroundspeed )
end
rate = math.min(rate, 2)
ply:SetPlaybackRate( rate )
if ( ply:InVehicle() ) then
local Vehicle = ply:GetVehicle()
// We only need to do this clientside..
if ( CLIENT ) then
//
// This is used for the 'rollercoaster' arms
//
local Velocity = Vehicle:GetVelocity()
ply:SetPoseParameter( "vertical_velocity", Velocity.z * 0.01 )
// Pass the vehicles steer param down to the player
local steer = Vehicle:GetPoseParameter( "vehicle_steer" )
steer = steer * 2 - 1 // convert from 0..1 to -1..1
ply:SetPoseParameter( "vehicle_steer", steer )
end
end
end
|