EZ Fabrik IK [Deprecated] - Inverse Kinematics Intended for any Motor6d Rig

Should make procedural animation really easy. Thank you!

1 Like

September 9, 2020 Changelog, Version 0.9:

  1. Motor6d Parent dependencies are gone, since it uses the Part0 property. Placement of motor6ds in rig no longer mattes :partying_face:

  2. Methods found to use the already made LimbChain object to create multiple chains bringing Mr. Floopy Man to life:

  1. Debug mode: creates and puts parts where the FABRIK algorithm thinks the motors should be during UpdateMotors() like in the unconstrained version video with random colors and stuff.
leftLegChain:DebugModeOn()
  1. New third parameter in LimbChain allowing the movement of the spine or body whatever you call it :partying_face:,
local spineChain = LimbChain.new(spineMotorTable,false,lowerTorsoMotor)
4 Likes

September 12,2020 Changelog, Version 1.0:

  1. Primary and secondary constraints! Allow the algorithm to not glitch out with a work flow like this:
    My tip is to use the ball socket constraints as I read somewhere online that FABRIK works better with a conical constraint method rather than an angle based hinge constraint.
Sample Code
--Set up two constraint tables to allow
local leftLegConstraintsPrimary = {upperLegBallSocketConstraint,lKneeHinge,lLegHinge,rigidFeet}
local leftLegConstraintsSecondary = {upperLegBallSocketConstraintAlternative,lKneeBallSocket,lLegBallSocket,rigidFeet}

--Set the constraints of the object
leftLegChain:SetPrimaryConstraints(leftLegConstraintsPrimary)
leftLegChain:SetSecondaryConstraints(leftLegConstraintsSecondary)

--Set the region for the primary constraints
local leftLegRegionPart1 = lowerBody.ConstraintZones.LeftLegPart1
local leftLegRegionPart2 = lowerBody.ConstraintZones.LeftLegPart2
local leftLegRegion = {leftLegRegionPart1,leftLegRegionPart2}
leftLegChain:SetPrimaryConstraintRegion(leftLegRegion)
  1. LimbChain:IterateUntilGoal() function is less glitchy now by updating the motors after every iteration to update the parts which are constraining the Model.
1 Like

finnaly i can make dani’s inverse kinematics as he said they are kinametics but inversed

September 22, 2020, Version 1.2 and 1.1:

  1. Version 1.1, Introduces a rudimentary foot placing system that places a foot on a surface at a point. Just add two attachments to the LimbChain object like in the place file and enable the bool option for IncludeFoot and it’s good to go! Or you could also this system to change the target position from the joint (by default) to an attachment like going from the wrist to the fingertip.

  2. Version 1.2, Finally worked out how to lerp the motors without them detaching like a ray man. Now by default it’s on just because of how good it looks however there are options to disable it or adjust by setting the Object’s properties like below:

    --Bool to turn on lerp mode and by default it's true because it just looks nicer
    LimbChain.LerpMotors = true
    --Default LerpAlpha is 0.25 or 1/4 to make it look nicer like it has momentum,
    LimbChain.LerpAlpha = 1/4
3 Likes

13 October 2020, Version 1.2.1:

This time the update is very small as I added a very small nil check to the LimbChain:UpdateMotors() function in order for all the parts that are being updated exist before trying to index their CFrames.

Edit: Whoops forgot to mention I deleted the store motor C0 method, feels unnecessary and could be way better implemented so it gets updated alongside LimbChain:UpdateMotors() method which maybe is the problem since it’s a do-all method.

However, the most important change is the attribution and credits section of the community resource where I noted some very important copyright concerns in the disclaimer in order to hopefully avoid future conflicts with the project.

Moreover, I also further listed some of my inspiration towards the project stemming from Mech games on Roblox which Roblox is severely lacking rn I’d be happy if anyone were to take up that task I’m too busy with Uni rn.

Anyways, I’m curious if people are using this resource? If not then, please vote in the poll below to see what could be improved of this resource:

  • Documentation
  • Better Foot Placement
  • Other Features pls describe

0 voters

But yeah so far I’m able to make it work for my purpose for procedural animations thanks to @iGottic amazing procedural animation method of doing it client-sided since well yeah the computer doesn’t like too much IK math. It’s the same script but modified to work with my IK method, a few attachments to denote where I want it to step to, and in a module script.

Hope you guys enjoy the resource though and are able to make it work!

8 Likes

Thank you so much for your contribution, this should help alot of people who are confused on using motor6D, the last picture left me laughing can’t lie :joy:

1 Like

November 1, 2020 Changelog, Version 1.3:

  1. So yeah I did some comment based documentation, and generally tidied up the module scripts by rewriting my entire Git history and squashed it from 154 commits to 72 commits kinda messed up the tags previously but it works. Also, I consolidated it into one LimbChain module script after discovering what init.lua does in Rojo so it follows a similar format to RotatedRegion3.

  2. Also added a debugging mode using an enhanced cone mesh to visualize the range of ball socket constraints. It’s not exactly accurate especially for the hinge constraints but it’s better than having to visualize mentally.

And I’m kinda burnt out after trying a lot of things to fix the constraints and mixing and matching CFrames it just fared a lot worse and didn’t work…

Hopefully, to expand on the project a different algorithm should be used and I expect Cyclic Coordinate Descent Inverse Kinematics (CCDIK) to solve my problems especially with hinge constraints.

This GitHub resource thanks to Johnathon Selstad which I found online has a really cool interactive IK arm with some PsuedoCode and a real code example in javascript to help understand CCDIK. Perhaps someone can import it to Lua? It would be cool but would also require some Quanternion knowledge to clamp the constraints of the rotation expressed within EulerAngles. However yeah the way it mentions the possibility of CCDIK to implement a working hinge constraint got me interested.

For now, the FABRIK works I guess, I wanna make my mech shoot a gun first so yeah.

7 Likes

Thank you for this. I’ve been looking for a Inverse Kinematics on roblox. I can now start my very long and painful progress for my War Of the Worlds Tripod for my game.

1 Like

Do you have the File for the Floppy Man?
I would like it as I need it for a reference for my tripod legs.

1 Like

I believe it’s already there in the place file in the github I placed him in replicated storage, and the server script controlling is a disabled script called MultiChain which you will need to re-enable.

1 Like

I reenabled MultiChain. Also Found Floppy Man and r15 inside lighting.
I tested them out and it seems there incomplete as they do not move but are rigged

Here is the rbxlx file, sorry the server script wasn’t updated with the new location of the LimbChain module which is fixed in this place file.

MechTest.rbxlx (754.6 KB)

3 Likes

19 January 2021 changelog

As of 19 January 2021, this module is deprecated due to the number of bugs especially the glaring problem when one of the model’s parts is not oriented (0,0,0) which will cause the leg to bend in a weird way, moreover, the organization of the module is well not that good due to excessive inheritance for the constraints.

Consequently, yeah use the newer CCDIKController which is much easier to use in my opinion especially with the newer constraint methods to make the inverse kinematics behave as it should be.

Perhaps I’ll see if I can also combine both FABRIK and CCDIK methods into the other resource so stay tuned for updates.

3 Likes

It doesn’t say if it’s server sides so… is it server sided or no? If ‘no’ then why?

For this question, well it’s up to you. All the module does is change the C0 of the motors meaning if you use it in a local script it’ll be local and if you do it on a server script it’ll be server-sided.

But if you notice the performance of around 2%-6% activity then it’s advisable to do it only on the client for performance reasons if the intended purpose is aesthetical which inverse kinematics usually is.

The client could do all the calculations and only send a position to the server, which means it would run faster. Spread the load or something? Idk I just want server sided ik.

What you can do to make it server sided yet performance-kind, is to use client replicated scripts. What I mean is that a local script would be added to every player that joins the game (maybe in the player gui, player scripts etc). This will not make it show on the server, but It will show on everyone else in the game.

1 Like

I want to use this on my Pj Pug-a-pillar rig (look it up). So when the rig moves the rest of the body will follow like a snake. However I’m not sure how exactly to go about it.

The creator made a disclaimer in the OP that this method is deprecated.