Using the Module.new() function, you need to specify 4 parameters to initialize an R15 IK rig, as documented. This is entirely optional if you don’t want to use it on one.
Hook a script up (local script or server script) to StarterCharacterScripts, and have some code that is like this (sort of):
local RunService = game:GetService("RunService")
local Character = script.Parent
local Module = require(YourIKModulePath)
local IK = Module.new() -- R15: UpperTorso, LowerTorso, Humanoid, HumanoidRootPart
RunService:BindToRenderStep("YourLegRender", 1, function()
-- do your IK stuff here
end)
I’m trying to make it only solve when the ray hits an object, but it seems to only solve it when the player is moving. Once again this IK module only allows for 2 joints as it uses the law of cosines which can only be used to determine 2 thetas. It’s a very restricted module as some may want to use more than 2 joints, that’s why I think FABRIK is still the best option. Regardless, the module was very readable and it could use more comments like what variables are optional/needed, e.g. the fact that the Hip/Knee variables need to be the original C0 for those joints and not the joints themselves. (I think). In your gifs you showed it working with an idle pose that maintains a very still position, I haven’t tested it but how do you think it will work with animations? I’ve used almost the same method of solving leg/arm inverse kinematics, it looked fine except when I started walking/running the legs look super weird. An entirely IK based rig is definitely what should be shot for, foot planting alone can look very weird with default Roblox animations.
The module itself has no issues but I would prefer more documentation. It’s still slightly lacking in terms of usability compared to other methods, but since you just made it an easy module I won’t put that on you.
Hey there,
I do believe that I need to add some more documentation, but I was mostly aiming for two jointed Inverse Kinematics motion (which is why it only supports R15). I do believe that it can support more joints if you use the module’s :Solve() in something like a chain, but this is untested. I’ve tested out using regular ROBLOX animations with the IK module, and with the Oldschool animation pack (the one I have on right now), it looks quite weird, which is why you only see a full IK rig in the provided examples.
Your raycast solving only when the player is moving may be due to your code, unless your ray code is running every step or without any type of movement checks. I’ll definitely change the Hip and Knee parameters since it is very confusing at first glance (I believe some of the documenting inside of the module would explain that?).
Overall, really good criticism! I’ll be taking this into thought and may update my module to fix the given issues.
Sorry to other you again, I am a rookie scripted and for some reason it is still not working for me. I have a starter character. What exactly should I put to make the character be completely animated using the module - just like the demo videos? Sorry to bother you I am a noob
Sorry- It has some very important things needed for it to work. You would need to replicate all the scripts. I will uncopylock my testing place, though, for you to test it out!
I tried to bind the arm to two attachments on the gun but this is what happening.
Could you please tell me what is wrong with it?
if Handle:FindFirstChild("LeftWeld") then
local NewLeftShoulder,NewLeftElbow = IKcharacter:SolveArm(Handle.Position +
Handle.LeftWeld.Position, character.LeftUpperArm.LeftShoulder.C0,
character.LeftLowerArm.LeftElbow.C0)
character.LeftUpperArm.LeftShoulder.C0 = NewLeftShoulder
character.LeftLowerArm.LeftElbow.C0 = NewLeftElbow
local Repp = game.ReplicatedStorage:FindFirstChild("ReplicateJoint")
if Repp then
Repp:FireServer({character.LeftUpperArm.LeftShoulder,character.LeftUpperArm.LeftShoulder.C0},{character.LeftLowerArm.LeftElbow,character.LeftLowerArm.LeftElbow.C0})
end
end
if Handle:FindFirstChild("RightWeld") then
local NewRightShoulder,NewRightElbow = IKcharacter:SolveArm(Handle.Position + Handle.RightWeld.Position, character.RightUpperArm.RightShoulder.C0, character.RightLowerArm.RightElbow.C0)
character.RightUpperArm.RightShoulder.C0 = NewRightShoulder
character.RightLowerArm.RightElbow.C0 = NewRightElbow
local Repp = game.ReplicatedStorage:FindFirstChild("ReplicateJoint")
if Repp then
Repp:FireServer({character.RightUpperArm.RightShoulder,character.RightUpperArm.RightShoulder.C0},{character.RightLowerArm.RightElbow,character.RightLowerArm.RightElbow.C0})
end
end
You’re probably trying to blend the default arm animations with the IK animations, I can’t remember if Transform or C0 was done to achieve this but you’d probably want to set the Arm’s frame without blending it with the default walk animations.