How to set Motor6D.Transform in World Space?

Hello!

I think the title is self explanatory, but I want to move Motor6D.Part1 to a CFrame in World Space using Motor6D.Transform. This needs to be done while Motor6D.C0 and Motor6D.C1 can be any CFrame value, and assume they can’t be changed, because I want to use key framed animations at the same time on the Motor6D.

I can’t find any documentation on this or any previous topics. I have tried offsetting Motor6D.Transform by Motor6D.C0 and Motor6D.C1 in multiple different ways, yet no dice. I’ve been trying to work it out on paper but the matrix math is a little beyond me and I don’t have a robust understanding on how Motor6D.Transform works.

Any solution is greatly appreciated!

2 Likes

Just update it every PreSimulation also im pretty sure you are looking for IKControl

To be more precise, I’m trying to add a procedural recoil animation for weapons. I am updating every PreSimulation, but the CFrame is being offset somehow by C0 and C1, or by some other factor I’m unaware of. This is leading to the Transform making arms levitate, and all sorts of goofy things.

Just dont change C0 and C1;
Rely on roblox animator or Transform property only.

Yes, I’m not touching either of those values. But the default C0 and C1 for some of the Motor6Ds are not CFrame.new() or something similar, causing the Motor6D.Transform I set to be offset.

Well yeah?That what transform does?
formula is somewhat C0*C1:Inverse()*Transform afaik
Obviously it will start from product of C0 and C1 and not CFrame.identity

So all I have to do is find the reverse of that equation and apply it to a WorldSpace CFrame to have the Transform be set to exactly that value?

I’m not too good with CFrame math, but could a potential solution like this work out?

Don’t shoot me, but I used AI to reverse the formula for Transform. Not sure if this actually works. :sweat_smile:

local TargetCF = -- The ideal CFrame of Part1
local Transform = Motor.C0:Inverse() * Motor.Part0.CFrame:Inverse() * TargetCF * Motor.C1

Motor.Transform = Transform

Well, that equation is wrong. Even Matrix transformations are too much for AI. But I did find what I thought it would be:

Motor.Transform = Motor.Part0:ToObjectSpace(WorldSpace) * Motor.C0:Inverse * Motor.C1

But that isn’t it, because I still have this very small offset:

The red part is where the arm should be.

Hey! I got it!

It turns out the equation I posed here:

Is almost right

It just is:

Motor.Transform = Motor.C0:Inverse * Motor.Part0:ToObjectSpace(WorldSpace) * Motor.C1

You just have to move the Inverted C0 to the beginning, I guess because it’s the starting point (Woah)!

So, if you want to move a part to a Global Space CFrame, you just have to use this equation:

Motor.Transform = Motor.C0:Inverse * Motor.Part0:ToObjectSpace(WorldSpace) * Motor.C1

Where WorldSpace Is a CFrame that represents WorldSpace values!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.