mirror of
https://github.com/CapsAdmin/pac3.git
synced 2025-03-04 03:03:01 -05:00
Fixed clip planes lagging behind when parented to a bone on a model part
Resolves last reported problem on issue #1341
This commit is contained in:
parent
760ee74017
commit
4e8eb09f16
@ -290,12 +290,12 @@ function PART:GetBonePosition()
|
||||
if not self.bone_index then return ent:GetPos(), ent:GetAngles() end
|
||||
|
||||
local m = ent:GetBoneMatrix(self.bone_index)
|
||||
if not m then return ent:GetPos(), ent:GetAngles() end
|
||||
|
||||
local pos = m:GetTranslation()
|
||||
local ang = m:GetAngles()
|
||||
|
||||
return pos, ang
|
||||
if m then
|
||||
return m:GetTranslation(), m:GetAngles()
|
||||
else
|
||||
return ent:GetPos(), ent:GetAngles()
|
||||
end
|
||||
end
|
||||
|
||||
function PART:GetBoneMatrix()
|
||||
@ -306,12 +306,15 @@ BUILDER:Register()
|
||||
|
||||
pac.AddHook("OnEntityCreated", "hide_mesh_no_crash", function(ent)
|
||||
local ply = ent:GetRagdollOwner()
|
||||
|
||||
if ply:IsPlayer() and ply.pac_inf_scale then
|
||||
for i = 0, ply:GetBoneCount() - 1 do
|
||||
local scale = ply:GetManipulateBoneScale(i)
|
||||
|
||||
if scale == inf_scale then
|
||||
scale = Vector(0,0,0)
|
||||
scale = vector_origin
|
||||
end
|
||||
|
||||
ply:ManipulateBoneScale(i, scale)
|
||||
end
|
||||
end
|
||||
|
@ -40,6 +40,12 @@ do
|
||||
function PART:PreOnDraw()
|
||||
bclip = render_EnableClipping(true)
|
||||
|
||||
-- this fixes clip planes lagging behind when parented to a bone on a model part
|
||||
local owner = self:GetParentOwner()
|
||||
if owner:IsValid() and owner.PACPart then
|
||||
pac.SetupBones(owner)
|
||||
end
|
||||
|
||||
local pos, ang = LocalToWorld(self.Position + self.PositionOffset, self:CalcAngles(self.Angles + self.AngleOffset), self:GetBonePosition())
|
||||
local normal = ang:Forward()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user