HingeConstraint failing to restrict IK motion on character

I’m trying to learn how to animate using IK via IKControl on ROBLOX, and I’m following the guide ROBLOX provides. Inverse Kinematics | Documentation - Roblox Creator Hub
I’m at the point of creating the constraint for the elbow, and after following all steps, the HingeConstraint is failing to restrict the elbow. First picture is with a target that requires very little limb motion. Second picture shows the HingeConstraint failing when the target is more challenging. The warning arrows appear, and clearly the limb shouldn’t be able to bend like that. The video in the guide shows that the PrimaryAxis for both attachments should always be identical, yet they are evidently deviating from each other in runtime. I tried activating LimitsEnabled but that didn’t alter behavior. I attempted the full guide manually (without using code) but arrived at the same problem. I was also unable to find relevant information on the DevForum. Not sure if I’m missing a step, or perhaps the guide is no longer accurate.


--This is a server script running inside a non-player character
local npc = script.Parent --The R15 skinned avatar from the native rig builder
--The following code follows the steps outlined in the official IK guide
local IKTarget = Instance.new("Attachment")
IKTarget.Name = "IKTarget"
IKTarget.Position += Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1) --A random target position for the sake of testing
IKTarget.Parent = npc.HumanoidRootPart
local IKControl = Instance.new("IKControl")
IKControl.Target = IKTarget
IKControl.EndEffector = npc.LeftHand 
IKControl.ChainRoot = npc.LeftUpperArm
IKControl.Type = Enum.IKControlType.Transform --Set in accordance with guide
IKControl.Parent = npc.Humanoid
local LeftElbowConstraintAttachment0 = Instance.new("Attachment",npc.LeftUpperArm.LeftElbowRigAttachment)
LeftElbowConstraintAttachment0.Name = "LeftElbowConstraintAttachment0"
local LeftElbowConstraintAttachment1 = Instance.new("Attachment",npc.LeftLowerArm.LeftElbowRigAttachment)
LeftElbowConstraintAttachment1.Name = "LeftElbowConstraintAttachment1"
LeftElbowConstraintAttachment1.CFrame= LeftElbowConstraintAttachment0.CFrame --Both attachments should have the same orientation value
local ElbowConstraint = Instance.new("HingeConstraint")
ElbowConstraint.Name = "LeftElbowConstraint"
ElbowConstraint.Attachment0 = LeftElbowConstraintAttachment0
ElbowConstraint.Attachment1 = LeftElbowConstraintAttachment1
ElbowConstraint.Parent = npc.LeftLowerArm
1 Like

You have to set the Workspace property IKControlConstraintSupport to Enabled. However, even after I did this, I couldn’t get it to work. If you find a solution, please post.

3 Likes

Here’s what I’m see replicating the video in the tutorial. My hinge attachments split apart as the arm is raised and lowered, whereas in the tutorial video they stay welded together.

You’re a legend, this comment is a life-saver that has solved my 5+ hours of trying to get hinges to work with IK constraints. I wish you much good luck my friend.

1 Like

I did a video tutorial for the wrist constraint. How to use ball socket constraint on wrist - Inverse Kinematics, Roblox - YouTube

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.