new hitpos pac bones

hitpos_world_props: stops at world or a physics prop, has normal angle
hitpos_world: stops at world, has normal angle
hitpos_world_noang: stops at world, has 0,0,0 angle
This commit is contained in:
pingu7867 2023-04-27 16:37:17 -04:00 committed by GitHub
parent baa13dc15d
commit 8645f39e86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,6 +107,9 @@ function pac.GetAllBones(ent)
tbl.footstep = {friendly = "footsteps", is_special = true}
tbl.skirt = {friendly = "skirt", is_special = true}
tbl.skirt2 = {friendly = "skirt2", is_special = true}
tbl.hitpos_world_props = {friendly = "hitpos_world_props", is_special = true}
tbl.hitpos_world = {friendly = "hitpos_world", is_special = true}
tbl.hitpos_world_noang = {friendly = "hitpos_world_noang", is_special = true}
tbl.hitpos_ent_ang = {friendly = "hitpos_ent_ang", is_special = true}
tbl.hitpos_ent_ang_zero_pitch = {friendly = "hitpos_ent_ang_zero_pitch", is_special = true}
tbl.pos_ang = {friendly = "pos_ang", is_special = true}
@ -261,6 +264,21 @@ function pac.GetBonePosAng(ent, id, parent)
return ent:EyePos(), ent:EyeAngles()
elseif id == "eyepos_ang" then
return ent:EyePos(), ent:GetAngles()
elseif id == "hitpos_world_props" then
local res = util_QuickTrace(ent:EyePos(), ent:EyeAngles():Forward() * 16000, function(ent)
return ent:GetClass() == "prop_physics"
end)
return res.HitPos, res.HitNormal:Angle()
elseif id == "hitpos_world" then
local res = util_QuickTrace(ent:EyePos(), ent:EyeAngles():Forward() * 16000, function(ent)
return ent:IsWorld()
end)
return res.HitPos, res.HitNormal:Angle()
elseif id == "hitpos_world_noang" then
local res = util_QuickTrace(ent:EyePos(), ent:EyeAngles():Forward() * 16000, function(ent)
return ent:IsWorld()
end)
return res.HitPos, angle_origin
elseif id == "hitpos" or id == "hit position" then
if ent.pac_traceres then
return ent.pac_traceres.HitPos, ent.pac_traceres.HitNormal:Angle()