Leg Controller (IK Included) - A quality solution to leg movement

Here is the video.

External Media
2 Likes

image
StarterPlayerScripts. Not StarterCharacterScripts

4 Likes

Oh, I think i need more sugar.Thanks!

3 Likes

the lack of torso lean or rotation really makes this look awkward I would suggest adding that

also ur that weird crim tryhard

8 Likes

Yes i agree that without proper torso tilting the system does not look good. I thought of including torso tilting but I decided not to because I wanted to call the module Leg Controller. For the next release I will add a tilting script bundled with the controller. Also Im not a Crim tryhard I just suck and get mad :sob:.

3 Likes

Looks like a better version of this: R6 IKPF (Inverse Kinematics Procedural Footplanting)

imo I think this looks cleaner and better. Great resource!

3 Likes

I’ve not been able to test this myself yet. But based off of the videos you provided, this is very pleasing to see and I can imagine very pleasing to experience first-hand.

Does this support strafing and backpedaling (with default animations, for example)? I see some slight leg turns when moving sideways, which I like to see. Seeing backpedaling with this resource enabled would be amazing.

I can’t open your module at the moment to see if animations are used, adjusted, if everything is strictly body part repositioning via script, etc.

All in all, this looks awesome! Keep it up!

4 Likes

I could potentially maybe add backpedaling support but it is not guaranteed. Pretty much the module changes the C0 of leg related joints.

5 Likes

Are you planning to add IK to r15? would be a great addition

3 Likes

Yes I am planning that for a future update to the module.

2 Likes

Totally understandable! I’m looking forward to what’s in store in the future :slight_smile: Great work!

3 Likes

Wow, this is incredibly useful and looks fantastic in-game. I had been searching for something like this for quite a while now and I’m really glad I was able to find this, Thank you!

I did encounter a bug when sitting with a custom animation, but I managed to resolve it. I do agree with Digby, the absence of torso rotation does feel a bit odd, similar to there being no backpedaling. However, aside from that, it’s a wonderful addition!

2 Likes

Very awesome, this is incredibly easy to use and works well.
My only issue so far is this


The legs like to stand weird when nearing the edge of a step. Each step is 1 stud in height and 1.5 studs in width (or length, it’s the space a step has until the next step begins).
It happens the other way too, just flip the character to face left and you’ll see the same thing.

3 Likes

I will fix this issue potentially for the next release

2 Likes

Does this account for climbing? I don’t want to walk diagonally onto a ladder and have tilted legs.

4 Likes

Awesome work, glad you shared it with us.

(Looks very funny on stairs that are 40 deg+ lol)

4 Likes

Is there a way to turn this off and on without destroying the character? Sometimes I need to play animations and the legs don’t want to play nice with them.

For now I added a little bit of code that works fine for me, but if there already was a way to do this I missed it.

Edit: Code broke.

Edit 2: Code fixed?

-- Script should go inside of "StarterPlayerScripts"
-- Services --
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local BaseLeftC0 = nil
local BaseRightC0 = nil

-- Modules / Directories --
local LegController = require(game.ReplicatedStorage.ModularFolders.ScriptObjects.LegController)

-- Misc --
local CharacterTable = {}

local function OnCharacterAdded(Character : Model)
	if Character == nil then --Sometimes Character is passed as nil
		return
	end
	
	if table.find(CharacterTable, Character.Name) then return end
	
	Character:WaitForChild("Torso",3)
	BaseLeftC0 = Character.Torso["Left Hip"].C0
	BaseRightC0 = Character.Torso["Right Hip"].C0

	CharacterTable[Character.Name] = {}
	CharacterTable[Character.Name].LegController = LegController.new(Character)

	Character.Destroying:Connect(function()
		CharacterTable[Character.Name].LegController:Destroy()
		CharacterTable[Character.Name] = nil
		
		if InkeConnection ~= nil then
			InkeConnection:Disconnect()
		end
	end)
end

-- Connections --
Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(OnCharacterAdded)
end)

Players.LocalPlayer.CharacterAdded:Connect(OnCharacterAdded)

for Index, Player in pairs(Players:GetPlayers()) do
	if (Player ~= Players.LocalPlayer) then
		OnCharacterAdded(Player.Character)
		Player.CharacterAdded:Connect(OnCharacterAdded)
	end
end

InkeConnection = nil
local function EnableDisableLegs()
	if Players.LocalPlayer.Character.InkeLegs.Value == true then
		CharacterTable[Players.LocalPlayer.Name] = {}
		CharacterTable[Players.LocalPlayer.Name].LegController = LegController.new(Players.LocalPlayer.Character)
	elseif Players.LocalPlayer.Character.InkeLegs.Value == false then
		CharacterTable[Players.LocalPlayer.Character.Name].LegController:Destroy()
		CharacterTable[Players.LocalPlayer.Character.Name] = nil
		Players.LocalPlayer.Character.Torso["Left Hip"].C0 = BaseLeftC0
		Players.LocalPlayer.Character.Torso["Right Hip"].C0 = BaseRightC0
	end
end
local function CreateEnableDisable(Character)
	local InkeLegs = Instance.new("BoolValue")
	InkeLegs.Name = "InkeLegs"
	InkeLegs.Value = true
	InkeLegs.Parent = Character
	
	InkeConnection = InkeLegs:GetPropertyChangedSignal("Value"):Connect(EnableDisableLegs)
end
Players.LocalPlayer.CharacterAdded:Connect(CreateEnableDisable)
2 Likes

Awesome module, great job.

I suggest adding torso movement to make this more fluid and intuitive as well as fixing the issue, if you will, which was pointed out by @Lleventyate

image

PS: It seems as though the legs don’t replicate to the server?

Player 1:
image

Player 2:
image

2 Likes

I make the ‘Destory’ typo so much… :sob:


I might use this module as a way to learn IK, since I don’t know how to use it yet!

1 Like

yo good work you got there mate, i also added your controller Torso Tilt:


tested with First Person Body View:

tested with Run System:

tested with Crouch System:

tested with weapons:

it still works with IK legs i just added and changed the part where RootJointC0 and NeckC0 can tilt and lean at same time because I wanted the legs to move to the left and right in 90/-90 degrees but to make it less weird (Example: legs keep collab to eachother in 90 or -90 degrees) i added Torso Tilt to fix my problem. Your Model was actually well made ngl, i hope in the future you can make a better one (like an improvement of the remade) and fix some of the IK legs bug that’s annoying people using it.

7 Likes