R6 Inverse Kinematics

Hello! robert_stevey here. I wanted to contribute to the community by releasing this module I have been working on for a bit.

I introduce you to…

R6 Inverse Kinematics Module

This is a module that solves Inverse Kinematics problem on the limbs of an R6 rig. Now what differentiates this module from other Inverse Kinematics modules is that it simulates what a 2 joint solver on an R6 rig. Dont get it? Well here is a demo of it:
LtwLkMBc0I

All of this is inspired by BlackShibe in his “Writing FPS Framework, Part 2”

Source

You can get the source of the module here
R6IK.rbxm (4.1 KB)

Oh and if you are interested, here is a github for it which includes a documentation too

I hope this can help others.

74 Likes

Thank you so much for this. It works perfectly!

5 Likes

Where do I put it the module script?

3 Likes

Anywhere you would like!, though I recommend you to put it under ReplicatedStorage for shared access.

4 Likes

This didn’t get alot of recogonition, Just wanna tell you, you did a amazing job on this! :smile:

5 Likes

Awesome module! Do you have a reference to the underlying algorithm at work here?

3 Likes

Thank you, the algorithm I used here is the same as what was used in this post: 2 Joint 2 Limb Inverse Kinematics

3 Likes

Thank you, I do remember coming across this post some time ago and I was never able to resurface it for some reason! I’ve been using this module to implement a climbing system, which is coming along pretty nicely.

5 Likes

is there a way to disable rotation on the Z axis?
currently working on procedural walk animations and it looks really weird on the legs

1 Like

Pretty good.
me likey
good job

1 Like

This is a really good and useful module.

Quick question though: There is a dynamicsound module in the github alongside the R6IK folder. Is that also for open-source?

1 Like

Yep it is! all things that I open sourced for Roblox related projects are placed in the repository!

P.S. if you’re interested in the dynamic sound module here is a post about it

1 Like

i have an r6 startercharacter and i inserted this script inside it, it isnt working. can you help me?

Did you only insert it without requiring it and using it like a module? I’m not sure what’s the problem here

When i use it the player’s arm starts flying off into the sunset.

Code:

–Some Localscript
local Remote = game:GetService(‘ReplicatedStorage’).Remotes.Grapple
local Plr = game.Players.LocalPlayer
local Mouse = Plr:GetMouse()
local uis = game:GetService(‘UserInputService’)

while task.wait() do
if uis:IsKeyDown(Enum.KeyCode.Q) then
Remote:FireServer(Mouse.hit.Position)
end
end

–Some ServerScript
local Remote = game:GetService(‘ReplicatedStorage’).Remotes.Grapple
local R6IK = require(game:GetService(‘ReplicatedStorage’).Modules.R6IK)

Remote.OnServerEvent:Connect(function(Plr, MouseHit : Vector3)
if Plr.Character then
local IK = R6IK.New(Plr.Character)
IK:ArmIK(‘Left’, MouseHit)
end
end)

It flies off into the sunset once you press E. It works for the legs but not the arms

I see the problem here, I should have stated this before but you must use the .New function Once and not every time you want to do IK.

So to fix your code, here is the solution that I found. (Server script)

local Remote = game:GetService("ReplicatedStorage").Remotes.Grapple
local Players = game:GetService("Players")
local R6IK = require(game:GetService("ReplicatedStorage").Modules.R6IK)

local PlayerInfo = {}

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function()
		PlayerInfo[Player] = {IK = R6IK.New(Player.Character)}
	end)
end)

Remote.OnServerEvent:Connect(function(Plr, MouseHit : Vector3)
	if Plr.Character then
		local IK = PlayerInfo[Plr].IK
		IK:ArmIK("Left", MouseHit)
	end
end)

Can you give a sample of using this for footplanting pls
I can’t figure out a way for ik to be compatible with my walking animations

That is up to you to implement, I haven’t done any footplanting code which includes this module yet. I might do it in the future but im not sure

1 Like

I keep getting a buffing error while opening the game, are you able to link a model?