FP convar
This commit is contained in:
parent
7fd2fba51e
commit
efb50f2c5e
|
@ -8,6 +8,9 @@ local cam_r = CreateConVar( "b-cam_r", 12 )
|
||||||
local cam_u = CreateConVar( "b-cam_u", 12 )
|
local cam_u = CreateConVar( "b-cam_u", 12 )
|
||||||
local cam_fov = CreateConVar( "b-cam_fov", 75 )
|
local cam_fov = CreateConVar( "b-cam_fov", 75 )
|
||||||
|
|
||||||
|
local cam_fp = CreateConVar( "b-cam_fp", 0 )
|
||||||
|
local lastfp
|
||||||
|
|
||||||
local m = 3
|
local m = 3
|
||||||
local m2 = Vector( m, m, m )
|
local m2 = Vector( m, m, m )
|
||||||
local m1 = m2:GetNegated()
|
local m1 = m2:GetNegated()
|
||||||
|
@ -25,6 +28,9 @@ function CamSpot( ang, pos )
|
||||||
mins = m1,
|
mins = m1,
|
||||||
maxs = m2,
|
maxs = m2,
|
||||||
}
|
}
|
||||||
|
if cam_fp:GetBool() then
|
||||||
|
tr.endpos = EyePos()
|
||||||
|
end
|
||||||
tr = util.TraceHull(tr)
|
tr = util.TraceHull(tr)
|
||||||
return tr.HitPos
|
return tr.HitPos
|
||||||
end
|
end
|
||||||
|
@ -37,44 +43,59 @@ function GM:CalcView( ply, pos, ang, fov )
|
||||||
drawviewer = true
|
drawviewer = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if false then
|
local fp = cam_fp:GetBool()
|
||||||
|
if fp then
|
||||||
ply:SetupBones()
|
ply:SetupBones()
|
||||||
local bm = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.006"))
|
local bm = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.006"))
|
||||||
view.origin = bm:GetTranslation()
|
view.origin = bm:GetTranslation()
|
||||||
|
|
||||||
if ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun") and ply:GetLayerCycle( GESTURE_SLOT_JUMP )<0.8 then
|
if ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun") then
|
||||||
local angles = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.004")):GetAngles()
|
local progress = ply:GetLayerCycle( GESTURE_SLOT_JUMP )
|
||||||
angles.y = ang.y
|
|
||||||
|
|
||||||
local magic = math.Remap( ply:GetLayerCycle( GESTURE_SLOT_JUMP ), 0.6, 0.8, 0, 1 )
|
progress = math.TimeFraction( 0.15, 0.7, progress )
|
||||||
magic = math.Clamp( magic, 0, 1 )
|
progress = math.Clamp( progress, 0, 1 )
|
||||||
angles.p = Lerp( magic, angles.r-90, ang.p )
|
progress = math.ease.OutCirc( progress )
|
||||||
angles.r = 0
|
|
||||||
view.angles = angles
|
local Dir = ply:GetVelocity()
|
||||||
else
|
Dir.z = 0
|
||||||
local special = math.Remap( ang.p, 0, 79, 0, 1 )
|
Dir:Normalize()
|
||||||
special = math.Clamp(special, 0, 1 )
|
Dir:Rotate( Angle( 0, view.angles.y, 0 ) )
|
||||||
special = math.ease.InCubic( special )
|
Dir:Negate()
|
||||||
local special2 = math.Remap( ang.p, -79, 0, 0, 1 )
|
|
||||||
special2 = math.Clamp(special2, 0, 1 )
|
local Addition = Angle( (progress*360), 0, 0 )
|
||||||
special2 = special2 * (1-special)
|
|
||||||
view.origin:Sub(ang:Forward()*2)
|
local new = Angle( view.angles )
|
||||||
view.origin:Add(ang:Up()*4*special2)
|
new:Add( Addition )
|
||||||
view.origin:Add(ang:Up()*4*special)
|
|
||||||
|
view.angles = new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local special = math.Remap( ang.p, 0, 79, 0, 1 )
|
||||||
|
special = math.Clamp(special, 0, 1 )
|
||||||
|
special = math.ease.InCubic( special )
|
||||||
|
local special2 = math.Remap( ang.p, -79, 0, 0, 1 )
|
||||||
|
special2 = math.Clamp(special2, 0, 1 )
|
||||||
|
special2 = special2 * (1-special)
|
||||||
|
view.origin:Sub(ang:Forward()*2)
|
||||||
|
view.origin:Add(ang:Up()*4*special2)
|
||||||
|
view.origin:Add(ang:Up()*4*special)
|
||||||
|
end
|
||||||
|
|
||||||
|
if lastfp == nil then lastfp = !fp end
|
||||||
|
if lastfp and !fp then
|
||||||
|
local bid = ply:LookupBone("DEF-spine.006")
|
||||||
|
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
|
||||||
|
local bid = ply:LookupBone("DEF-spine.005")
|
||||||
|
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
|
||||||
|
lastfp = fp
|
||||||
|
print("show")
|
||||||
|
elseif !lastfp and fp then
|
||||||
local bid = ply:LookupBone("DEF-spine.006")
|
local bid = ply:LookupBone("DEF-spine.006")
|
||||||
ply:ManipulateBoneScale( bid, vector_origin )
|
ply:ManipulateBoneScale( bid, vector_origin )
|
||||||
local bid = ply:LookupBone("DEF-spine.005")
|
local bid = ply:LookupBone("DEF-spine.005")
|
||||||
ply:ManipulateBoneScale( bid, vector_origin )
|
ply:ManipulateBoneScale( bid, vector_origin )
|
||||||
--local bm = ply:GetBoneMatrix(bid)
|
lastfp = fp
|
||||||
--bm:Scale(Vector(0, 0, 0))
|
print("hide")
|
||||||
--ply:SetBoneMatrix(bid, bm)
|
|
||||||
--local bid = ply:LookupBone("DEF-spine.005")
|
|
||||||
--local bm = ply:GetBoneMatrix(bid)
|
|
||||||
--bm:Scale(Vector(0, 0, 0))
|
|
||||||
--ply:SetBoneMatrix(bid, bm)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return view
|
return view
|
||||||
|
|
Loading…
Reference in New Issue