Transforming positional points to Motor6D joints

lol looks like I’m asking a lot of questions nowadays but oh well

For another side project of mine, I am working on an inverse kinematic system that is based around the FABRIK algorithm (interestingly, Roblox uses the same algorithm for their own animation plugin). The end goal will be to have this module open-sourced for everyone to use (and making it dummy-proof so anybody can easily get into it and make procedural animations). I have everything basically down, except for this one part. There have been a few IK examples but none that really helped me in a particular matter. Why? Because most of them only goes up to a few joints before it stops working but mine allows as long of a chain in your rig as realistically possible.

I have not really played around with Motor6Ds or Welds much, and the most experiences I have with them are using a free model welding script (because let’s be truthful, who wants to reinvent the wheel when we already got working weld scripts?). Before I get onto my question, this is my IK rig:

The “legs” aren’t actually rigged. They are merely points that acts as a guide on where a part should bridge. This is how the IK looks without the bridged parts:

How would I efficiently convert these “guides” into working points of positions that actual rigs can use? For example, how would I use these three points to make my R15 rig’s legs bend?

Edit: Suggestions for improvement are also welcome as well if you have a better alternative to how I can do it.

4 Likes

In order to convert the points to motor6d joints one would have to first understand the motor6d system which is what I’m trying to do for my IK system inspired by your IK solver and this other thread by LMF_Hutch where I was able to understand the motor6d system.

Here is the mind-boggling schematic that the other thread made by realizing the motor joint system with the C0’s and the C1’s and how it is relative to the p0 part and the p1 part:

So here is a text based description based on how it is structured:
Motor6d Properties of the joint between the hip and the upper leg:
P0 Part: Hip
P1 Part: UpperLeg
C0 vector from center of the hip (part P0) going towards to where the rig joint was placed
C1 vector is from the center the upper leg (part P1) to where the rig joint was placed

Using this information we can obtain the position of the rig’s joints relative to the placement in the world. The math would be like World —> Hip center Position —> Joint C0 which in script terms would be like hip.Position + hipJoint.C0.p

In the end, by obtaining the vectors of the joints to joints (ex: hip joint to knee joint) I was able to obtain this janky leg which sorta works if the target position is directly in front of the hip.

85f255cee6d56fb83368340252a73324
Edit: here is my module code for the fabrik algorithm where I basically did the steps described the EgoMoose for forwards and backwards manually by hand.
Edit 2: module code is removed due to having errors regarding vector math sry

Hope this helps.
BTW love pwn incrypt I still have your vip tshirt

2 Likes