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,21 +43,33 @@ 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
|
|
||||||
|
progress = math.TimeFraction( 0.15, 0.7, progress )
|
||||||
|
progress = math.Clamp( progress, 0, 1 )
|
||||||
|
progress = math.ease.OutCirc( progress )
|
||||||
|
|
||||||
|
local Dir = ply:GetVelocity()
|
||||||
|
Dir.z = 0
|
||||||
|
Dir:Normalize()
|
||||||
|
Dir:Rotate( Angle( 0, view.angles.y, 0 ) )
|
||||||
|
Dir:Negate()
|
||||||
|
|
||||||
|
local Addition = Angle( (progress*360), 0, 0 )
|
||||||
|
|
||||||
|
local new = Angle( view.angles )
|
||||||
|
new:Add( Addition )
|
||||||
|
|
||||||
|
view.angles = new
|
||||||
|
end
|
||||||
|
|
||||||
local magic = math.Remap( ply:GetLayerCycle( GESTURE_SLOT_JUMP ), 0.6, 0.8, 0, 1 )
|
|
||||||
magic = math.Clamp( magic, 0, 1 )
|
|
||||||
angles.p = Lerp( magic, angles.r-90, ang.p )
|
|
||||||
angles.r = 0
|
|
||||||
view.angles = angles
|
|
||||||
else
|
|
||||||
local special = math.Remap( ang.p, 0, 79, 0, 1 )
|
local special = math.Remap( ang.p, 0, 79, 0, 1 )
|
||||||
special = math.Clamp(special, 0, 1 )
|
special = math.Clamp(special, 0, 1 )
|
||||||
special = math.ease.InCubic( special )
|
special = math.ease.InCubic( special )
|
||||||
|
@ -63,18 +81,21 @@ function GM:CalcView( ply, pos, ang, fov )
|
||||||
view.origin:Add(ang:Up()*4*special)
|
view.origin:Add(ang:Up()*4*special)
|
||||||
end
|
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