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

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

4 Likes

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

3 Likes

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

4 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!

3 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.

4 Likes

I will fix this issue potentially for the next release

4 Likes

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

6 Likes

Awesome work, glad you shared it with us.

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

5 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)
4 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

3 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!

2 Likes

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.

8 Likes

It is not supposed to replicate to the server it’s supposed to handle everything even other players on the client as server replication is sometimes a problem for optimization. There was a problem maybe connecting it to the other player.

1 Like

I could possibly make a function called pause that would stop leg controller from animating until an unpause function is called.

1 Like

Leg Controller V1.2 releasing soon today


  • Fixing IK bugs
  • Fixing connection issues
  • Adding torso tilt
  • Expanding customization
  • Adding more functions such as Freeze / Unfreeze
4 Likes

great job and congrats for fixing and adding new features,when it released i will test it and then come back soon!

2 Likes

Leg Controller V1.2 release


9 Likes

good update you got there! i tested in few ways and added Legs Cframe.new to stop the collision between 2 legs, also added Neck Tilt and Arm Tilt:









ngl you made it worked with few new systems u got inside the script, adding IK value and the other values in Loader Script is such a good idea! worked with all my systems and i can make a IK option in Settings now (so people can either enable it or disable it) Trove is also a great Module and developers can customize the script freely now! i like how when you jump everything set up Angle to complete 0 and that’s just cool as heck!

3 Likes

For some reason this isn’t working, I’ve put all the scripts in the right place and looked at every comment. I don’t have the torso tilt on my character. Please can somebody help.

2 Likes

how about of using Blockcast instead of using Raycast

idk about ik and how to improve the performance and solve bug

1 Like