Hello, just a heads up; this will require some basic knowledge of Bones & CFrame
I have a part connected to a chain of bones which I used @EgoMoose’s FABRIK module to calculate the required orientation of these chains to make this effect
The code works excellent from what you can see in the video, I’m setting the calculated coordinates from the module into the Bone’s WorldCFrame; but I later realize this takes a huge toll on performance for whatever reason, which means I must be manipulating the CFrame property instead of the Bones.
I thought this would be as simple as transferring the world cframe into object space with the ToObjectSpace method which is how my code looks now;
This is how the code below makes the chain system look: here
The code used to calculate the joints from the module
local origin = CFrame.new(chain.origin + (chain.target - chain.origin).Unit * chain.totallength/2, chain.target)
for i, _ in next, chain.joints do
local n = i < #chain.joints and i + 1; if n then
local v = chain.joints[n] - chain.joints[i]
local cframe = CFrame.new(chain.joints[i] + v/2, chain.joints[n]) -- The World CFrame of the current bone.
local offset = cframe:ToObjectSpace(origin) --> Should've turned the World CFrame into local orientation, but it's not quite exactly similar
-- bones[i].WorldCFrame = cframe --> this works but makes it super laggy
bones[i].CFrame = offset
end
end
After more experimenting done, I notice that the Roblox bone system takes CFrame influence of it’s parent Bone + the offset cframe of the Bone itself; which is calculated by:
local WorldCFrame = bone_attachment.Parent.CFrame * bone_attachment.CFrame
this can be seen here
Using this information, how can I build the local orientation needed to displace the bone’s CFrame by to get the same effect?