Using IKControl to make Footplant

Hello people! I’ m Emper and i’ m tryng to summon programmers who can help me or show me how to make footplanting using the new IKControl!

I have been experimenting with the new beta feature that roblox added “IKControl” and what i have been tryng to do is footplant using it, but however i never get the result i want.

In the documentation Inverse Kinematics | Roblox Creator Documentation
You can see in the second video a very nice and amazing footplant that uses IKControl does anyone know how i can achieve the same result?

Thanks to anyone who is able to help!

1 Like

You’re going to need quite a list of things for it to function properly.

Step 1: Get a rig of some kind. This can be a default character rig.
Step 2: Make sure the Humanoid has an Animator Instance.
Step 3: Put an IKControl Instance in the Humanoid.

Example:
image

The IKControl will interact with the Animator to overwrite existing animations.

Step 4: Assign the 3 properties that are necessary for the IKControl Instance to operate.
image

The “ChainRoot” would be like the UpperRightArm. It is the beginning of the chain, and the closest to the center without being the “Torso” or “main” rig part.
The “EndEffector” is the very last part in the chain, like the RightHand.
The “Target” is a part in workspace that the “EndEffector” will try to “point” towards.

In this example, I’m moving the “Target” part:
RobloxStudioBeta_AVYg1CIqrY

You will need to program a script to use RayCasts to find suitable locations for your character/rig’s feet to land.

For this 8-Legged robot I’m designing, I’m using several RayCasts to determine each foot’s appropriate location. Attachments can be useful for determining where those RayCasts should start:

RobloxStudioBeta_dlFX0WTaXp

So, in my case, the ChainRoot is the first segment of each leg, which is closest to the main body.
The EndEffector is the claw at the end of each leg.
And the Target is the very tiny, invisible part in Workspace.
These Targets are moved by a script to obtain the desired effect based on RayCast positions, which start at the WorldPosition of Attachments.

I’ve had to do a lot of research on the subject, but the results are very cool. I hope it turns out well for you!

6 Likes

Just made a new community resource for this:

Hey Oblivic you are truly amazing and absolutely love you for answering with such specific and helpful explenation, with no doubt this will definetly help me so much and i’ m very grateful. However i do have one more question! As you said i need to use raycasts to find the ground so i know which part i have to make the target and you specified that Attachments can be useful for this. Can you provide me with an example of the raycast origin and raycast direction using those attachments? Thank you very much!

Oh my god dthecoolest in person who answers to my post! I’ m so happy that you provided me with code example however sadly that’ s not what i’m looking for as it doesn’ t seem to work as i imagined… :smiling_face_with_tear: I don’ t know if i just didnt use it right or have to set up something but from the video and me tryng it just doesn’ t give me the same feeling i was going for like in the inverse kinematics footplant example video

STILL thank you a lot and i’ m so happy that i had someone who i admire a lot that helped me!

1 Like

Here’s a diagram to help explain the process:

Here is the hierarchy of attachments used:
image

Here’s some details on how this is accomplished.
First, I’m sending the Torso1Attachment and the “Target” to the SetFootLanding() function.

SetFootLanding(Torso1Attachment,Footfall1)

You can have this trigger during a loop, so it keeps looking for new possible locations to place the Target.

I think I’ve detailed exactly what’s happening pretty well here:

function SetFootLanding(MainAttachment,MainFootfall)
	-- This function uses the same RayCast methods for all useful attachments.
	-- MainAttachment is Torso1Attachment.
	-- MainFootfall is the "Target" that this leg will point towards.
	
	-- Attachment0's WorldPosition is used as a default state if all RayCasts fail.
	local NewFootPos = MainAttachment.Attachment0.WorldPosition
	
	-- Starting from Torso1Attachment's WorldPosition.
	-- Aiming at Attachment1's WorldPosition
	local StartPos = MainAttachment.WorldPosition
	local EndPos = MainAttachment.Attachment1.WorldPosition
	
	-- Use a UnitVector to tell it what direction to cast the RayCast.
	-- Multiplying the UnitVector by the distance between Torso1Attachment's WorldPosition and Attachment1's WorldPosition.
	local ray = Ray.new(
		StartPos,
		(EndPos - StartPos).unit * (StartPos - EndPos).Magnitude
	)
	local RayHit, RayPos, RayNormal = workspace:FindPartOnRay(ray, Character)
	
	-- If the first RayCast is able to connect with an object in the world, then it will assign NewFootPos to the position that the RayCast has hit.
	-- Otherwise, it will move on to the next RayCast.
	if RayHit~=nil then
		-- The first RayCast has hit something.
		-- It will change from Attachment0's default position to the newly found position.
		NewFootPos = RayPos
	else
		-- 1st RayCast has failed.
		-- Begin the same process again, but using Attachment1 and Attachment2 instead.
		StartPos = MainAttachment.Attachment1.WorldPosition
		EndPos = MainAttachment.Attachment2.WorldPosition
		ray = Ray.new(
			StartPos,
			(EndPos - StartPos).unit * (StartPos - EndPos).Magnitude
		)
		RayHit, RayPos, RayNormal = workspace:FindPartOnRay(ray, Character)
		
		if RayHit~=nil then
			-- 2nd Raycast successful.
			NewFootPos = RayPos
		else
			-- 2nd RayCast has failed.
			-- Begin the same process again, but using Attachment2 and Attachment3 instead.
			StartPos = MainAttachment.Attachment2.WorldPosition
			EndPos = MainAttachment.Attachment3.WorldPosition
			ray = Ray.new(
				StartPos,
				(EndPos - StartPos).unit * (StartPos - EndPos).Magnitude
			)
			RayHit, RayPos, RayNormal = workspace:FindPartOnRay(ray, Character)
			
			if RayHit~=nil then
				-- 3rd RayCast successful.
				NewFootPos = RayPos
			end
		end
	end
	MainFootfall.CFrame = CFrame.new(NewFootPos)
end

I have the Targets together in a Folder that I keep in the character’s model.
Let me know if you have any questions.

3 Likes

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