FP convar

This commit is contained in:
Fesiug 2024-09-21 14:13:17 -04:00
parent 7fd2fba51e
commit efb50f2c5e
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
1 changed files with 47 additions and 26 deletions

View File

@ -8,6 +8,9 @@ local cam_r = CreateConVar( "b-cam_r", 12 )
local cam_u = CreateConVar( "b-cam_u", 12 )
local cam_fov = CreateConVar( "b-cam_fov", 75 )
local cam_fp = CreateConVar( "b-cam_fp", 0 )
local lastfp
local m = 3
local m2 = Vector( m, m, m )
local m1 = m2:GetNegated()
@ -25,6 +28,9 @@ function CamSpot( ang, pos )
mins = m1,
maxs = m2,
}
if cam_fp:GetBool() then
tr.endpos = EyePos()
end
tr = util.TraceHull(tr)
return tr.HitPos
end
@ -37,44 +43,59 @@ function GM:CalcView( ply, pos, ang, fov )
drawviewer = true
}
if false then
local fp = cam_fp:GetBool()
if fp then
ply:SetupBones()
local bm = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.006"))
view.origin = bm:GetTranslation()
if ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun") and ply:GetLayerCycle( GESTURE_SLOT_JUMP )<0.8 then
local angles = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.004")):GetAngles()
angles.y = ang.y
if ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun") then
local progress = ply:GetLayerCycle( GESTURE_SLOT_JUMP )
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 )
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)
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 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")
ply:ManipulateBoneScale( bid, vector_origin )
local bid = ply:LookupBone("DEF-spine.005")
ply:ManipulateBoneScale( bid, vector_origin )
--local bm = ply:GetBoneMatrix(bid)
--bm:Scale(Vector(0, 0, 0))
--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)
lastfp = fp
print("hide")
end
return view