TPS camera, point the weapon at center of screen!
This commit is contained in:
parent
c1bfb596b0
commit
2be4facd8a
|
@ -273,7 +273,7 @@ function bennyfp( origin, angles, fov )
|
|||
|
||||
pos:Set( ply:GetPos() )
|
||||
pos.z = pos.z + 64
|
||||
ang:Set( angles )
|
||||
ang:Set( TPSOverride )
|
||||
|
||||
pos:Add( 16 * ang:Right() )
|
||||
pos:Add( -32 * ang:Forward() )
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
local wa, wb = 0, 0
|
||||
|
||||
local blop = Angle()
|
||||
|
||||
TPSOverride = Angle()
|
||||
hook.Add( "CreateMove", "CamFuck", function( cmd )
|
||||
if false and BENNY_ACTIVECAMERA and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
|
||||
local x, y = cmd:GetForwardMove(), cmd:GetSideMove()
|
||||
|
@ -51,6 +51,44 @@ hook.Add( "CreateMove", "CamFuck", function( cmd )
|
|||
cmd:SetViewAngles( blop )
|
||||
|
||||
end
|
||||
|
||||
if true then -- FPS cam
|
||||
local p = LocalPlayer()
|
||||
|
||||
local opos, ang = p:EyePos(), TPSOverride
|
||||
|
||||
ang:Add( Angle( cmd:GetMouseY()*0.022, -cmd:GetMouseX()*0.022, 0 ) )
|
||||
ang:Normalize()
|
||||
|
||||
-- PROTO: These and the values in CalcView should use a common function
|
||||
-- to get their position, and to allow easy shoulder switching or overhead.
|
||||
opos:Add( 16 * ang:Right() )
|
||||
opos:Add( -32 * ang:Forward() )
|
||||
opos:Add( 0 * ang:Up() )
|
||||
opos:Add( 16 * ang:Up() * (ang.p/90) )
|
||||
|
||||
local tr = util.TraceLine( {
|
||||
start = opos,
|
||||
endpos = opos+(ang:Forward()*(2^16)),
|
||||
filter = p,
|
||||
mask = MASK_SOLID,
|
||||
} )
|
||||
|
||||
local planner = (tr.HitPos-p:EyePos()):Angle()
|
||||
planner:Normalize()
|
||||
|
||||
local moveintent = Vector( cmd:GetForwardMove(), cmd:GetSideMove(), 0 )
|
||||
|
||||
local fixang = Angle()
|
||||
fixang.y = cmd:GetViewAngles().y - ang.y
|
||||
moveintent:Rotate( fixang )
|
||||
|
||||
cmd:SetViewAngles( planner )
|
||||
|
||||
cmd:ClearMovement()
|
||||
cmd:SetForwardMove( moveintent.x )
|
||||
cmd:SetSideMove( moveintent.y )
|
||||
end
|
||||
end)
|
||||
|
||||
function GM:PlayerNoClip()
|
||||
|
|
Loading…
Reference in New Issue