IK not turning limbs properly

I’m trying to make the IK always face the direction of the footplanting targets (green small parts)

I used the orange neon feet parts as a reference, they should always be facing towards the direction the IK is going but rarely turn towards the green, I’m not too familiar with IK so this is probs a problem with how i built the rig but :person_shrugging:


(rig image)


(vid showing the neon parts not facing green parts)

Also if you notice anything with the rig besides the actual problem im facing currently please tell me so I can fix it and make this look as good as possible!

also if anyone needs a vid with a less distracting rig I can do that since this ones kinda alot

Please show all IKControl properties.
Thanks!


EndEffector, Target, ChainRoot and Pole are all set through a script, if you want me to show which part is which please ask (kinda hard to show so i gotta redo a bit of the model which i wont do unless you need it :+1:) , im assuming its a problem with either weight or pole but im not exactly sure what weight performs?


two front are the poles for each leg (not the bottom ones)

Add constraints with limits, read about them here: Inverse Kinematics | Documentation - Roblox Creator Hub

Looks like HingeConstraint is the one you need.

when I was a kid, I used this code to set it up

server side:

	local feet: { IkControls.IkChain } = {
		{
			name = "LeftFoot";
			endEffector = character:WaitForChild("LeftFoot") :: BasePart;
			positionChainRoot = character:WaitForChild("LeftUpperLeg") :: BasePart;
			hingeConstraintData = {
				upper = character:WaitForChild("LeftUpperLeg"):WaitForChild("LeftKneeRigAttachment") :: Attachment;
				lower = character:WaitForChild("LeftLowerLeg"):WaitForChild("LeftKneeRigAttachment") :: Attachment;
				minAngle = 0;
				maxAngle = 180;
			}
		},
		{
			name = "RightFoot";
			endEffector = character:WaitForChild("RightFoot") :: BasePart;
			positionChainRoot = character:WaitForChild("RightUpperLeg") :: BasePart;
			hingeConstraintData = {
				upper = character:WaitForChild("RightUpperLeg"):WaitForChild("RightKneeRigAttachment") :: Attachment;
				lower = character:WaitForChild("RightLowerLeg"):WaitForChild("RightKneeRigAttachment") :: Attachment;
				minAngle = 0;
				maxAngle = 180;
			}
		},
	}

	for _, ikChain in feet do

		-- Attachments
		local target = Instance.new("Attachment")
		target.Name = ikChain.name .. "Target"
		target.Parent = character

		playersIkData[player].ikData[ikChain] = {
			target = target;
		}

		-- HingeConstraints
		local hingeConstraint = Instance.new("HingeConstraint")
		hingeConstraint.Name = ikChain.name .. "Constraint"
		hingeConstraint.Attachment0 = ikChain.hingeConstraintData.upper
		hingeConstraint.Attachment1 = ikChain.hingeConstraintData.lower
		hingeConstraint.LimitsEnabled = true
		hingeConstraint.LowerAngle = ikChain.hingeConstraintData.maxAngle
		hingeConstraint.UpperAngle = ikChain.hingeConstraintData.minAngle
		hingeConstraint.Parent = humanoid
	end

client side (Pole is not used):

		local positionIk = Instance.new("IKControl")
		positionIk.Name = data.name
		positionIk.Type = Enum.IKControlType.Transform
		positionIk.EndEffector = data.positionEndEffector
		positionIk.ChainRoot = data.positionChainRoot
		positionIk.Target = data.target
		positionIk.Parent = humanoid

and actually it still works:

Ensure that target is oriented correctly, that is, it has the CFrame you want to be applied to EndEffector

This is really cool and I had no idea constraints had effect on IK behavior!
One problem is there a way to use 1 attachment if not how do I make it use 2 attachments, a bit confused on where a second attachment would go or even be attached to

as you can see (please read the code) upper and lower for character’s right leg are:

As I understood, there’s no need to think much: once constraint is parented to humanoid, it affects animations.

Oh shoot I did see that I just thought this was outdated since I tried to put both Att0 and Att1 as the same attachment and Att1 would always become nil, lemme experiment with it and see if I’m doing something wrong before coming back to this..

rig with target incase im dumb and dont understand it (99%)
ikguy.rbxm (19.1 KB)

bump just in case anyone else wants to give their two cents

HingeConstraint has same attachment at both slots:


should be (the part closest to IK’s root should be at Attachment0):

then fix angles.

i hate to bug you but do you mind sending the fix model just so i can analyze it

ikguy_00.rbxm (19.5 KB)

changed:

  • fixed Attachment0 of the HingeConstraint
  • enabled the constraint
  • changed IKControl type to Position