mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Fix setting angle was always relative (#3180)
Added ragdollGetAng to reduce confusion with ragdollSetAng
This commit is contained in:
parent
d96229615e
commit
01fa17cdf7
@ -92,6 +92,7 @@ E2Helper.Descriptions["setPos(b:v)"] = "Sets the position of a bone."
|
||||
E2Helper.Descriptions["setAng(b:a)"] = "Set the rotation of a bone."
|
||||
E2Helper.Descriptions["ragdollSetPos(e:v)"] = "Sets the position of a ragdoll while preserving pose."
|
||||
E2Helper.Descriptions["ragdollSetAng(e:a)"] = "Set the rotation of a ragdoll while preserving pose."
|
||||
E2Helper.Descriptions["ragdollGetAng(e)"] = "Gets the rotation of the root bone. This is equivalent to entity:bone(0):angles()"
|
||||
E2Helper.Descriptions["ragdollGetPose(e:)"] = "Gets a specially built table containing the pose of the ragdoll. See ragdollSetPose."
|
||||
E2Helper.Descriptions["ragdollSetPose(e:t)"] = "Sets the pose of a ragdoll while preserving position and angle. See ragdollGetPose."
|
||||
E2Helper.Descriptions["ragdollSetPose(e:tn)"] = "Sets the pose of a ragdoll while preserving position. Setting rotate to 0 makes the ragdoll use the pose's original angle. See ragdollGetPose."
|
||||
|
@ -1145,6 +1145,15 @@ e2function void entity:ragdollFreeze(isFrozen)
|
||||
|
||||
end
|
||||
|
||||
__e2setcost(5)
|
||||
|
||||
e2function angle entity:ragdollGetAng()
|
||||
if not ValidAction(self, this) then return end
|
||||
|
||||
local phys = this:GetPhysicsObject()
|
||||
|
||||
return phys:IsValid() and phys:GetAngles() or self:throw("Tried to use entity without physics", Angle())
|
||||
|
||||
__e2setcost(150)
|
||||
|
||||
e2function void entity:ragdollSetPos(vector pos)
|
||||
@ -1160,8 +1169,9 @@ end
|
||||
e2function void entity:ragdollSetAng(angle rot)
|
||||
if not ValidAction(self, this, "rot") then return end
|
||||
|
||||
local o = this:GetPhysicsObject():GetAngles()
|
||||
for _, bone in pairs(GetBones(this)) do
|
||||
setAng(bone, bone:AlignAngles(this:GetForward():Angle(), rot))
|
||||
setAng(bone, bone:AlignAngles(o, rot))
|
||||
end
|
||||
|
||||
this:PhysWake()
|
||||
|
Loading…
Reference in New Issue
Block a user