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