Two Bone IK Elbow Magnet 3D Help

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Wild Western

I have created my own Two Bone IK Solver system for 3d skeletons that works well with no noticeable bugs. However there is no system in place to orientate the bone chain so that the “elbow” or “knee” looks at a point in 3d space. I have only done some testing here and there to get a system to no avail and was wondering if anyone had done this or know of any idea on how to get one working. This project is done in C# but I can translate C++ or GDScript to C# just fine so any code snippets are accepted if you are willing to provide.

:bust_in_silhouette: Reply From: MrEliptik

I can’t find the documentation but there’s a property named magnet under the SkeletonIK if I recall correctly. I think this is what you want.

This video demonstrates it https://youtu.be/Q4o_7_Rh510

Sorry for the miss communication unfortunately. This is my own ik solver and not the built in one, so I am asking as to how the magnet works in say the SkeletonIK node, but you reminded me I can look at source.
edit* It seems as if the solver solves the chain with the magnet in mind using interpolation so I’m still not sure how to do this with Law of Cosigns

Wild Western | 2021-03-23 23:42

Oh right, I misread! I’m sorry it goes beyond my scope.
If you want to take a look, Blender also has open sources https://github.com/blender/blender/blob/master/source/blender/ikplugin/intern/iksolver_plugin.c

MrEliptik | 2021-03-24 07:54

:bust_in_silhouette: Reply From: Wild Western

I have completed it myself and will post a link to a github in a few days on how I did it.
I stole a method from unity SignedAngle and used a Plane to determine the rotation around my arm normal given the projected points of my elbow and my magnet.

GitHub - GainAw/GodotCSharpProjectTests: This is where I post my tests and findings for the godot engine link to demo project(s)