mirror of
https://github.com/Winded/RagdollMover.git
synced 2025-03-04 03:13:36 -05:00
Check if bone is visible on screen; use dot product for distances
- Also make dark colors darker so gradient is more noticeable
This commit is contained in:
parent
f12c354f43
commit
707cec284b
@ -1124,18 +1124,24 @@ function AdvBoneSelectRender(ent, bonenodes, prevbones, calc)
|
||||
local mx, my = input.GetCursorPos() -- possible bug on mac https://wiki.facepunch.com/gmod/input.GetCursorPos
|
||||
local nodesExist = bonenodes and bonenodes[ent] and true
|
||||
local bonedistances = {}
|
||||
local plpos = LocalPlayer():EyePos()
|
||||
local eyeVector = LocalPlayer():GetAimVector()
|
||||
local mindist, maxdist = nil, nil
|
||||
|
||||
if calc then
|
||||
prevbones = {}
|
||||
|
||||
for i = 0, ent:GetBoneCount() - 1 do
|
||||
local dist = plpos:DistToSqr( ent:GetBonePosition(i) )
|
||||
if not mindist or mindist > dist then mindist = dist end
|
||||
if not maxdist or maxdist < dist then maxdist = dist end
|
||||
local pos = ent:GetBonePosition(i)
|
||||
local dist = 1000
|
||||
if pos:ToScreen().visible then
|
||||
dist = eyeVector:Dot( pos )
|
||||
if not mindist or mindist > dist then mindist = dist end
|
||||
if not maxdist or maxdist < dist then maxdist = dist end
|
||||
end
|
||||
bonedistances[i] = dist
|
||||
end
|
||||
maxdist = maxdist or 1
|
||||
mindist = mindist or 0
|
||||
maxdist = maxdist - mindist
|
||||
end
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
RGM_Constants = {
|
||||
COLOR_RED = Color(200, 0, 0, 255),
|
||||
COLOR_DARKRED = Color(50, 0, 0, 255),
|
||||
COLOR_DARKRED = Color(25, 0, 0, 255),
|
||||
COLOR_GREEN = Color(0, 200, 0, 255),
|
||||
COLOR_DARKGREEN = Color(0, 50, 0, 255),
|
||||
COLOR_DARKGREEN = Color(0, 25, 0, 255),
|
||||
COLOR_BLUE = Color(0, 0, 200, 255),
|
||||
COLOR_CYAN = Color(0, 200, 200, 255),
|
||||
COLOR_DARKCYAN = Color(0, 50, 50, 255),
|
||||
COLOR_DARKCYAN = Color(0, 25, 25, 255),
|
||||
COLOR_YELLOW = Color(200, 200, 0, 255),
|
||||
COLOR_DARKYELLOW = Color(50, 50, 0, 255),
|
||||
COLOR_DARKYELLOW = Color(25, 25, 0, 255),
|
||||
COLOR_BRIGHT_YELLOW = Color(255, 255, 0, 255),
|
||||
COLOR_WHITE = Color(255, 255, 255, 255),
|
||||
COLOR_BLACK = Color(0, 0, 0, 255),
|
||||
|
Loading…
Reference in New Issue
Block a user