Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to rotate Motor6D over animation?

Asked by
YarikX 0
1 year ago

original post: link

Right now, in my project, I’m trying to rotate the animated hands of the player through Motor6D.

But the animation does not allow my Motor6D to indicate the desired degree of rotation.

Is it possible to somehow specify CFrame after the animation has done its calculations?

Idle animation video: https://devforum.roblox.com/uploads/short-url/oGG7CJquYPWZXuAWQBmPXlj56PF.wmv

I have a character, I already made him turn his body without problems. Although this is very strange, I have animations where I animate the body, and in this case, the rotation works fine.

When I wanted to do the same with my hands (I did everything according to the lesson), this method did not work, although it should logically.

I experimented a lot, I thought it was because of the animator that Roblox provides. I wrote my own animator and concluded that everything is precisely because of the animation that is being played, because if the animator is turned off, the hands work.

local neckC0 = CFrame.new(0, 0.8, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
local waistC0 = CFrame.new(0, 0.2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
local rShoulderC0 = CFrame.new(1, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
local lShoulderC0 = CFrame.new(-1, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);

function RotateParts(player, theta)
    local neck = player.Character.Head.Neck;
    local waist = player.Character.UpperTorso.Waist;
    local rShoulder = player.Character.RightUpperArm.RightShoulder;
    local lShoulder = player.Character.LeftUpperArm.LeftShoulder;

    neck.C0 = neckC0 * CFrame.fromEulerAnglesYXZ(theta*0.5, 0, 0);
    waist.C0 = waistC0 * CFrame.fromEulerAnglesYXZ(theta*0.5, 0, 0);


    rShoulder.C0 = rShoulderC0 * CFrame.fromEulerAnglesYXZ((theta*0.5), 0, 0);
    lShoulder.C0 = lShoulderC0 * CFrame.fromEulerAnglesYXZ((theta*0.5), 0, 0);
end

The code I use on the server to rotate player parts.

Thanks for the replies, and sorry for the bad English, I’m from Ukraine, so there might be some mistakes.

Answer this question