Torso animation conflicting with arms following cursor

i dont know much about motor6d, and i need help

i want to make a dynamic animation of a weapon following the cursor, so i used a script from How would I make a players arm move depending on the y axis of the mouse? (R6) - #8 by ToxicalGamer2006, but when i implemented it into the weapon, i encountered a bug where because of the animated torso, arms become more arched the farther away you from the center

as i said, i dont know much about motor6d, but i tried playing around with values and tried using RootJoint.Transform but it had no result whatsoever

-- game:GetService("RunService").RenderStepped:Connect(function()
	print(char.HumanoidRootPart["RootJoint"].Transform)
	
	--[[HumanoidRootPart Movement]]--
	if IsEquipped == true then
		--char.HumanoidRootPart.CFrame = CFrame.new(char.HumanoidRootPart.CFrame.Position, Vector3.new(m.Hit.p.X, char.HumanoidRootPart.CFrame.Position.Y, m.Hit.p.Z))
	end
	
	--[[Arms and Head Movement]]--
	if IsEquipped and AnimateArms.Value then
		
		if AnimateArms.Value then
			if char.Torso:FindFirstChild("Right Shoulder") then
				char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:Lerp(CFrame.new(1, .65, 0) * CFrame.Angles(math.asin((m.Hit.Position - m.Origin.Position).Unit.Y), 1.55, 0, 0) , 0.8)
			end
			if char.Torso:FindFirstChild("Left Shoulder") then
				char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:Lerp(CFrame.new(-1, .65, 0) * CFrame.Angles(math.asin((m.Hit.Position - m.Origin.Position).Unit.Y), -1.55, 0, 0) , 0.8)
			end
			if char.Torso:FindFirstChild("Neck") then
				char.Torso["Neck"].C0 = char.Torso["Neck"].C0:Lerp(CFrame.new(0, 1, 0) * CFrame.Angles(math.asin((m.Hit.Position - m.Origin.Position).Unit.Y) + 1.55, 3.15, 0), 1)
			end
		end
		
	else
		
		if not char:FindFirstChild("Torso") then return end
		if char.Torso:FindFirstChild("Right Shoulder") then
			char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:lerp(origRightS, 0.1)
		end

		if char.Torso:FindFirstChild("Left Shoulder") then
			char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:lerp(origLeftS, 0.1)
		end

		if char.Torso:FindFirstChild("Neck") then
			char.Torso["Neck"].C0 = char.Torso["Neck"].C0:lerp(origNeck, 0.1)

		end
		
	end
end)

This is how it looks right now:


this one is with the torso animation, its bugged and arching

this is the old version without torso animation:


this is the result i desire, but with the torso animation

is there any way to take the torso animation into account when calculating C0?

Hi! I assume that in the first video, the angle that the Torso makes with respect to HumanoidRootPart is not 0 (about Y axis) which is what is causing the issue (since torso is no longer on same orientation as the HumanoidRootPart. Now, unfortunately, I do not possess the solution of this problem, however, this problem is also plaguing me from making my gun system. I tried to fix this by switching the axes about which rotation happens, but to no avail. I am writing this reply, so that, in case a solution appears on this post, I can be notified as well.

come on people, is there really nobody who have a solution to this?
is there any other way to achieve this kind of effect other than changing the C0?

Don’t change C0. If you change Transform in PreSimulation then you can override the torso animation or you can add to the torso animation in whichever way you want.

The C0/C1 properties are only intended to describe the static offsets of Part0/Part1. Changing the Transform property is more correct than changing the C0 property (plus it’s also about 20x faster). It also usually makes the math easier because that’s what Transform is made for and not C0. When you play an animation, it’s the Transform property that the animation is updating, not the C0. All Motor6Ds work by positioning Part0 and Part1 such that the following equation remains true:

motor.Part0 * motor.C0 * motor.Transform == motor.Part1 * motor.C1

So when motor.Transform = CFrame.new(), we get

motor.Part0 * motor.C0 == motor.Part1 * motor.C1

Take the time to understand what this means visually.

1 Like

Hey, thank you for the answer, but im still unsure on how to change the transform property correctly, could you please provide a little more detail?