mirror of
https://github.com/Xerasin/Sit-Anywhere.git
synced 2025-03-04 03:13:07 -05:00
Even more minor touchup
This commit is contained in:
parent
11cd7f9e56
commit
aa0f935cc4
@ -9,7 +9,9 @@ local function ShouldSit(ply)
|
||||
return hook.Run("ShouldSit", ply)
|
||||
end
|
||||
|
||||
local arrow, drawScale = Material("widgets/arrow.png"), 0.1
|
||||
local arrow, drawScale, traceDist = Material("widgets/arrow.png"), 0.1, 20
|
||||
local traceScaled = traceDist / drawScale
|
||||
|
||||
local function StartSit(trace)
|
||||
local wantedAng = nil
|
||||
local cancelled = false
|
||||
@ -24,14 +26,13 @@ local function StartSit(trace)
|
||||
return
|
||||
end
|
||||
|
||||
local traceDist = 20
|
||||
local vec = util.IntersectRayWithPlane(ply:EyePos(), ply:EyeAngles():Forward(), trace.HitPos, Vector(0, 0, 1))
|
||||
if not vec then
|
||||
return
|
||||
end
|
||||
|
||||
local posOnPlane = WorldToLocal(vec, Angle(0, 90, 0), trace.HitPos, Angle(0, 0, 0))
|
||||
local testVec = posOnPlane:GetNormal() * traceDist / drawScale
|
||||
local testVec = posOnPlane:GetNormal() * traceScaled
|
||||
local currentAng = (trace.HitPos - vec):Angle()
|
||||
wantedAng = currentAng
|
||||
|
||||
@ -46,7 +47,7 @@ local function StartSit(trace)
|
||||
cam.Start3D2D(trace.HitPos + Vector(0, 0, 1), Angle(0, 0, 0), drawScale)
|
||||
surface.SetDrawColor(goodSit and Color(255, 255, 255, 255) or Color(255, 0, 0, 255))
|
||||
surface.SetMaterial(arrow)
|
||||
surface.DrawTexturedRectRotated(testVec.x * 0.5, testVec.y * -0.5, 2 / drawScale, traceDist / drawScale, currentAng.y + 90)
|
||||
surface.DrawTexturedRectRotated(testVec.x * 0.5, testVec.y * -0.5, 2 / drawScale, traceScaled, currentAng.y + 90)
|
||||
cam.End3D2D()
|
||||
end
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user