mirror of
https://github.com/Winded/RagdollMover.git
synced 2025-03-04 03:13:36 -05:00
Fixed positioning not working correctly for root bones of advanced bonemerged entities
This commit is contained in:
parent
e84d5f8241
commit
b8c7b7502d
@ -338,7 +338,12 @@ function ENT:Think()
|
||||
end
|
||||
end
|
||||
else
|
||||
ang = self.GizmoAng
|
||||
if pl.rgm.GizmoParentID ~= -1 then
|
||||
local physobj = ent:GetPhysicsObjectNum(pl.rgm.GizmoParentID)
|
||||
_, ang = LocalToWorld(vector_origin, self.GizmoAng, physobj:GetPos(), physobj:GetAngles())
|
||||
else
|
||||
_, ang = LocalToWorld(vector_origin, self.GizmoAng, ent:GetPos(), ent:GetAngles())
|
||||
end
|
||||
|
||||
local manang = ent:GetManipulateBoneAngles(bone)*1
|
||||
manang:Normalize()
|
||||
@ -385,7 +390,12 @@ function ENT:Think()
|
||||
end
|
||||
else
|
||||
if IsValid(ent) then
|
||||
ang = self.GizmoAng
|
||||
if pl.rgm.GizmoParentID ~= -1 then
|
||||
local physobj = ent:GetPhysicsObjectNum(pl.rgm.GizmoParentID)
|
||||
_, ang = LocalToWorld(vector_origin, self.GizmoAng, physobj:GetPos(), physobj:GetAngles())
|
||||
else
|
||||
_, ang = LocalToWorld(vector_origin, self.GizmoAng, ent:GetPos(), ent:GetAngles())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -65,10 +65,15 @@ function ENT:ProcessMovement(offpos, _, eyepos, eyeang, ent, bone, ppos, _, move
|
||||
_, boneang = LocalToWorld(vector_origin, diff, vector_origin, axis.GizmoParent)
|
||||
end
|
||||
else
|
||||
if IsValid(ent) then
|
||||
boneang = ent:GetAngles()
|
||||
if ent:GetClass() == "ent_advbonemerge" and parent:GetClass() == "prop_ragdoll" then
|
||||
boneang = angle_zero -- bone has no parent and isn't physical
|
||||
else
|
||||
boneang = angle_zero
|
||||
if pl.rgm.GizmoParentID ~= -1 then
|
||||
local physobj = ent:GetPhysicsObjectNum(pl.rgm.GizmoParentID)
|
||||
boneang = physobj:GetAngles()
|
||||
else
|
||||
boneang = ent:GetAngles()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,9 +29,9 @@ function ENT:ProcessMovement(_, offang, eyepos, eyeang, ent, bone, ppos, pnorm,
|
||||
local pl = axis.Owner
|
||||
|
||||
local axistable = {
|
||||
(self:GetParent():LocalToWorld(VECTOR_SIDE) - self:GetPos()):Angle(), --axis:LocalToWorldAngles(axis.DiscP:GetLocalAngles()),
|
||||
(self:GetParent():LocalToWorld(vector_up) - self:GetPos()):Angle(), --axis:LocalToWorldAngles(axis.DiscY:GetLocalAngles()),
|
||||
(self:GetParent():LocalToWorld(VECTOR_FRONT) - self:GetPos()):Angle(), --axis:LocalToWorldAngles(axis.DiscR:GetLocalAngles()),
|
||||
(self:GetParent():LocalToWorld(VECTOR_SIDE) - self:GetPos()):Angle(),
|
||||
(self:GetParent():LocalToWorld(vector_up) - self:GetPos()):Angle(),
|
||||
(self:GetParent():LocalToWorld(VECTOR_FRONT) - self:GetPos()):Angle(),
|
||||
(self:GetPos() - pl:EyePos()):Angle()
|
||||
}
|
||||
axistable[1]:Normalize()
|
||||
|
@ -60,10 +60,16 @@ function ENT:ProcessMovement(offpos, _, eyepos, eyeang, ent, bone, ppos, pnorm,
|
||||
_, boneang = LocalToWorld(vector_origin, diff, vector_origin, axis.GizmoParent)
|
||||
end
|
||||
else
|
||||
if IsValid(ent) then
|
||||
boneang = ent:GetAngles()
|
||||
if ent:GetClass() == "ent_advbonemerge" and parent:GetClass() == "prop_ragdoll" then
|
||||
boneang = angle_zero -- bone has no parent and isn't physical
|
||||
else
|
||||
boneang = angle_zero
|
||||
local pl = self:GetParent().Owner
|
||||
if pl.rgm.GizmoParentID ~= -1 then
|
||||
local physobj = ent:GetPhysicsObjectNum(pl.rgm.GizmoParentID)
|
||||
boneang = physobj:GetAngles()
|
||||
else
|
||||
boneang = ent:GetAngles()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -64,10 +64,16 @@ function ENT:ProcessMovement(offpos, _, eyepos, eyeang, ent, bone, ppos, pnorm,
|
||||
_, boneang = LocalToWorld(vector_origin, diff, vector_origin, axis.GizmoParent)
|
||||
end
|
||||
else
|
||||
if IsValid(ent) then
|
||||
boneang = ent:GetAngles()
|
||||
if ent:GetClass() == "ent_advbonemerge" and parent:GetClass() == "prop_ragdoll" then
|
||||
boneang = angle_zero -- bone has no parent and isn't physical
|
||||
else
|
||||
boneang = angle_zero
|
||||
local pl = self:GetParent().Owner
|
||||
if pl.rgm.GizmoParentID ~= -1 then
|
||||
local physobj = ent:GetPhysicsObjectNum(pl.rgm.GizmoParentID)
|
||||
boneang = physobj:GetAngles()
|
||||
else
|
||||
boneang = ent:GetAngles()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -835,7 +835,7 @@ net.Receive("rgmSendBonePos", function(len, pl)
|
||||
axis.GizmoPos = newpos
|
||||
|
||||
pl.rgm.GizmoPos = newpos - nonpos
|
||||
if not (axis.EntAdvMerged) then
|
||||
if not (axis.EntAdvMerged) and ent:GetClass() then
|
||||
local manang = entog:GetManipulateBoneAngles(boneog)
|
||||
manang:Normalize()
|
||||
|
||||
@ -2380,7 +2380,7 @@ local function rgmSendBonePos(pl, ent, boneid)
|
||||
gizmoppos = matrix:GetTranslation()
|
||||
gizmopang = matrix:GetAngles()
|
||||
else
|
||||
gizmoppos = ent:GetPos()
|
||||
gizmoppos = parent:GetPos()
|
||||
gizmopang = ent:GetAngles()
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user