Free R15 IKPF System (Inverse Kinematics Procedural Footplanting)

Hey, Not a clue how to script but would I be able to modify this to work with a custom body for say a creepy spider or robot walker thingy with multiple legs?
Ive seen something like this in the past with multiple legs and I wanted to recreate it however I have no clue how I would but this seems like a good place to start

2 Likes

Edit: For people asking here is the updated version:

IK_legs_updated.rbxl (40.9 KB)

So I realized clampA and ClampB were referring to the length of A and B for solving the IK. The reason for the non precise footplant was due to these being set values and not the IK formula I originally thought (Clamp A = 0.55 and ClampB = 1.15 was the set values in the module).

In order to solve this issue, I calculated the distance between the motor6dwelds. I think It would be nice to have it dynamic as the various character models existing on roblox have different hipheights and leg sizes.

Here is a before and after comparison.

Before:

Before

After: This should be scalable with any rigs I believe

After

16 Likes

There was mention of other animations being available, do you know where I can get those ?
Thanks

Thanks for this. I’ve been researching about it, but no results. I’ll give you a credit once I published the first beta of the game. Thanks Again!

i make my own but weird:
wait(1)
User = game.Players.LocalPlayer
Humanoid = User.Character.Humanoid
Torso = User.Character.Torso
L_Hip = Torso[“Left Hip”]
R_Hip = Torso[“Right Hip”]

local step = game:GetService(‘RunService’).RenderStepped;

function ArcTan(x, y)
r = math.atan(y / x)
if x < 0 then
r = r + math.pi
end
return r
end

vel = Vector3.new()
while true do
step:wait()
local velVector = Vector3.new(Torso.Velocity.X,0,Torso.Velocity.Z);
if velVector.magnitude > 0 then
m = (vel - Torso.Velocity).magnitude / Humanoid.WalkSpeed
vel = (Torso.Velocity * m + vel * 2) / (m + 2)
v = Torso.CFrame:pointToObjectSpace(vel + Torso.Position)
L_a = ArcTan(v.x, -v.z)
R_a = 3.1416 - ArcTan(v.x, v.z)
L_Hip.C1 = CFrame.new(0, 1, 0)*CFrame.Angles(0, L_a+math.pi, 0)
R_Hip.C1 = CFrame.new(0, 1, 0)*CFrame.Angles(0, R_a+math.pi, 0)
L_Hip.C0 = CFrame.new(-0.5, -1, 0)*CFrame.Angles(0, L_a-math.pi, 0)
R_Hip.C0 = CFrame.new(0.5, -1, 0)*CFrame.Angles(0, R_a-math.pi, 0)
L_Hip.MaxVelocity = Torso.Velocity.magnitude / 100
R_Hip.MaxVelocity = Torso.Velocity.magnitude / 100
else
L_Hip.C1 = CFrame.new(0, 1, 0)*CFrame.Angles(0, -1.57, 0)
R_Hip.C1 = CFrame.new(0, 1, 0)*CFrame.Angles(0, 1.57, 0)
L_Hip.C0 = CFrame.new(-0.5, -1, 0)*CFrame.Angles(0, -1.57, 0)
R_Hip.C0 = CFrame.new(0.5, -1, 0)*CFrame.Angles(0, 1.57, 0)
end
end

localscript in starterpack
it works it move when your character rotate

and i need someone can help me fix it.the script make the leg gap

5 Likes

how to make this IK works on my custom character?
hi.rbxm (51.5 KB)

Is this meant to work with rigs that are scaled differently?

I’m not sure, this is an old project of mine.

Sorry if this is a dumb question, but will there be support for animation in the future? The animations I have look really strange with the foot planting.

1 Like

It’s procedural animation, meaning it can’t overlap with existing animation.

1 Like

To prevent this, delete the keyframes that are playing for each of the legs. If you want to play animations without making the IKPF look goofy, you must remove every keyframe on anything related from below the waist of the Rig.

I have my own but, this is really cool and super smooth. Definitely better than mine. The only complaint that I have is that I wish that profiles could be more dynamic than just legs. So, for instance, arms, full body, torso, etc. I know that it deters for namesake but, the application for more than just legs would be significant imo. Still though, solid work!

1 Like

MANS I NEED THAT NOW plzplzplzplzplzplzplzplzplz

1 Like

boe
bone
If i turn up the walkspeed it looks like my bones are broken

I’ve noticed an issue with the model and place file.

if climbing then -- Don't animate if we are climbing, it looks weird
		rootvel = rootvel0
		rootvel = rootvel.Magnitude <---Here!
		self.Direction = rootcf.lookVector

It should be “rootvelm” not “rootvel”. This causes the output to be spammed with errors when climbing, as right below there is a division with the nil variable:

local up =rootvelm/18

@iGottic I seem to have run into an issue. It all works fine, except that the joint-bending part of it doesn’t work.

Here’s the rig:

ikpf problems rig

test rig ik physics.rbxm (12.1 KB)

Here’s how the profile is created:

local Stride = 2
local CycleSpeed = 14
local MaxRenderDistance = 1000

local RayOffset = 4

local Profile = IKPF.new(NPC, Stride, CycleSpeed, MaxRenderDistance, RayOffset)

(I’ve also made some changes to the module, as 1. the rig doesn’t have any arms, uppertorso or lowertorso and 2. the rig doesn’t contain a humanoid because I want it to be physically simulated)

Changing the RayOffset doesn’t seem to do much, setting it too low results in the legs bending backwards into the body, and setting it too high results in… well, nothing changes.

Hey! Nice module but i have a question is there a way to like enable animation only for arm or just give walk animation with ik?

Thank you in advence

Yeah someone made that type r6 ikpf in search you will get your results

Hello! Sorry if this is late, but can this be used with Rthro? My rig seems to be broken, the legs seem to be flying and when the character walks it looks… off…
(I used both normal r15 and with rthro)

I think this (might be) the problem, they’re probably off-centered

local RightHipCFrame = CFrame.new(0.5, -0.4, 0) -- The self.RightRotationAngle-hip reference CFrame, relative to the RightUpperLeg position
local LeftHipCFrame = CFrame.new(-0.5, -0.4, 0) -- The self.LeftRotationAngle-hip reference CFrame, relative to the LeftUpperLeg position
local RightHipCFrame2 = CFrame.new(0.5,-2.7,0)
local LeftHipCFrame2 = CFrame.new(-0.5,-2.7,0)

local RightIdleCFrame = CFrame.new(0.28,-1.9,0.03) -- Idle CFrame of Motor6D joint
local LeftIdleCFrame = CFrame.new(-0.28,-1.9,-0.03) -- Idle CFrame of Motor6D joint

well, i’m pretty sure that you need to edit it to make it work with rthro. rthro is different from past roblox packages, so that’s probably why. From what i’ve seen in your video, you actually need to remove the existing animations with a script (removes all animations entirely) as the ik animation overlaps with the rthro animation. Hope this helps!

1 Like