As the title says how do I do Inverse kinematics with 3 Motor6Ds.
I want to achieve this by setting the Motor6d’s CurrentAngle property.
XRotation rotates sideways.
Shoulder rotates up and down.
Elbow rotates up and down.
image of what I want to achieve (achieved by manually setting the values via properties).
![image](//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/4X/f/0/8/f08e6b5b19c513c5feed7ddff8d09235dba2f5a5.jpeg)
2 Likes
This tutorial explains how inverse kinematics work, and it’s definitely worth a read: 2 Joint 2 Limb Inverse Kinematics
I applied just the angle without using CFrame.Angles from the post you referred and I am getting weird results.
![image](//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/4X/f/e/8/fe80124a783a44c70f75a74c3ec99924e9a4f91c.png)
local RunService = game:GetService("RunService")
local Character = script.Parent
local Target = Character.UpperTorso.RightHand
local RightSh = Character.RightUpperArm.RightShoulder
local RightRot = Character.RightUpperArm.RightShoulderJoint.RightShoulderRot
local RightEl = Character.RightLowerArm.RightElbow
local b = 2 -- UpperArmSize
local a = 1.5 -- LowerArmSize
RunService.Heartbeat:Connect(function()
local Mag = (RightSh.C0.Position - Target.WorldPosition).Magnitude
RightSh.CurrentAngle = math.acos((-a^2 + b^2 - Mag^2) / (2 * b * Mag)) + math.pi/2
RightEl.CurrentAngle = math.acos((a^2 + b^2 - Mag^2) / (2 * a * b)) - math.acos((-a^2 + b^2 - Mag^2) / (2 * b * Mag))
end)
2 Likes
Update
I solved this by myself all i had todo was account for the Motor6D offset and Character orientation offset
1 Like
What exactly does this mean? I have the same problem and want to do 3 joints, and I want to know how to do it.