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

What Is Leg Controller?


Leg Controller is an object-oriented programming (OOP) based module that is designed to solve the common problem of static/boring leg movement in Roblox games/experiences. Furthermore, by using Leg Controller, you can allocate your time to more important aspects of your game/experience such as combat systems/gun systems and general gameplay.

Why should I use Leg Controller?


  • Versatile: Leg Controller is versatile meaning that it can fit right into most projects without any advanced/heavy modification.

  • Object Oriented: Leg Controller is an object-oriented module meaning that it is organized and can be uninitiated and interacted with very easily.

  • Customizable: Leg Controller is highly customizable meaning that you can fine-tune it for the perfect look and feel you are trying to convey.

  • Works Completely Client-Sided: Leg Controller does not need to be run on the server at all for it to replicate or function properly.

  • R15 And R6 Support: Leg Controller supports R15 and R6 adding to its versatility and its overall quality and compatibility.

What features does Leg Controller Offer?


  • Animation-supported Inverse Kinematics: Leg controller includes animation-supported Inverse kinematics (IK) which is something that is not commonly done properly or if it is done properly it is commonly not animation-supported.

  • Leg Tilting: Leg controller modulates the C0 of the left hip and right hip meaning that it can tilt the legs properly when moving left or right. This feature can save time because it eliminates the need for special strafing animations.

  • Torso Tilting: Leg controller modules the C0 of the root joint meaning that it can tilt the torso alongside the legs when moving left or right. This feature greatly increases visual quality.

How to setup Leg Controller:


  • When installing Leg Controller it is recommended that you put the module inside of “Replicated Storage” to ensure proper access and functionality.

  • Setup example:

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

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

-- Misc --
local CharacterTable = {}

local function OnCharacterAdded(Character : Model)
	if table.find(CharacterTable, Character.Name) then return end

	CharacterTable[Character.Name] = {}
	task.spawn(function()
		CharacterTable[Character.Name].LegController = LegController.new(Character, {
			ikEnabled = true,
			ikExclude = {},
			maxIkVelocity = 1.5,

			onStates = {
				Enum.HumanoidStateType.Running
			},
			activationVelocity = 1.5,
			maxRootAngle = 25,
			maxAngle = 32.5,
			interploationSpeed = {
				highVelocityPoint = 2.5, --Anything less than this will interpolation slowly
				Speed = 0.1,
			}
		})
	end)

	Character.Destroying:Connect(function()
		if CharacterTable[Character.Name].LegController then CharacterTable[Character.Name].LegController:Destroy() end
		CharacterTable[Character.Name] = nil
	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

Examples:


Leg tilting:

Inverse Kinematics:

Replication:

R15:

Leg Controller (Model Link)

138 Likes

Really nice. Any chance you’ve been considering doing the same but with R15? I’ve been waiting for someone to do something with R15, as stuff like this is beyond me. Or maybe I should ask, is this compatible with R15? I’m gonna assume no.

Great resource, if I work on any combat systems with R6 in the future I’m definitely going to be using this.

14 Likes

Yes I could 100% add support for R15 and I might do that as of today

9 Likes

Leg Controller V1.1 Release


  • Added R15 Support (Excludes IK)
7 Likes

Awesome! Just one thing I noticed:

Might wanna switch this to Destroy :stuck_out_tongue:

Otherwise everything seems to be working good :smiley:

11 Likes

Thank you for this. I have updated the module to specifically fix this issue please bring attention if there are any other issues.

6 Likes

Hey, this is really great module shown in the video but somehow i can’t get the leg rotation to work. I tried testing it in both r6 and r15, not a single error about the leg controller module in output.

7 Likes

It is most likely that the loader script was put inside of starter player scripts

4 Likes

But i put it in the StarterCharacter script as the set-up instruction say. I think i could check on this later, thanks.

4 Likes

if you can record a video of what is happening it would help immensely. Also fyi the effects of leg controller is easier to see in shift lock

3 Likes

Thanks, i’ll send a video real quick.

4 Likes

Weird, I actually put that script in StarterPlayerScripts and it worked perfectly.

4 Likes

Here is the video.

External Media
3 Likes

image
StarterPlayerScripts. Not StarterCharacterScripts

5 Likes

Oh, I think i need more sugar.Thanks!

4 Likes

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

also ur that weird crim tryhard

12 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:.

4 Likes

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

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

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

5 Likes

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

6 Likes