Why is the tool not in the same position as in the animation editor when the animation is played?

Hi, I am trying to make a “tool holding” animation, the animating part is not an issue, however, the tool isn’t positioned in the same place as in the animation editor when the animation is played. I have attached pictures below to illustrate my point.

This is what it looks like in the animation editor

and this is what it looks like when played

The tool, AK-47, is a model with a part named “AK47_Body”; the part contains a Motor6D that is attached to the head of the Rig that’s being used to animate. The Head is Part0 and AK47_Body is the Part1. The Model of the AK47 itself is parented to the rig.

and in case the code is the issue, here’s the code being used to play the animation(forgive the sloppiness)
The code is housed in a server Script that’s parented in a tool object

local tool  = script.Parent

local hold_animation = tool:WaitForChild("Holding_Animation");

local ak = tool:WaitForChild("AK47")

local character = nil;
local humanoid = nil;

local hold_track = nil

tool.Equipped:Connect(function()
	character = tool.Parent;
	humanoid = character:WaitForChild("Humanoid");
	local animator = humanoid:FindFirstChild("Animator");

	local root = character:WaitForChild("Head")
	local main_body = ak:WaitForChild("AK47_Body");

	local joint = Instance.new("Motor6D", main_body);
	joint.Part0 = root
	joint.Part1 = main_body

	hold_track = animator:LoadAnimation(hold_animation)
	hold_track:Play()
end)

tool.Unequipped:Connect(function()
	character = nil;
	humanoid = nil;
	hold_track:Stop(0);
	hold_track = nil
end)

Thank you.

4 Likes

I mean all you can really do is just reposition the Motor6D’s Part0 and Part1’s positions. I don’t really know what’s causing the difference in position from the animation editor to when it becomes a tool.

2 Likes

I figured it out. The reason why it happened is because the motor6d that was used to animate had a C0 and C1 value, but the Motor6d that I used to play the animation had C0 and C1 values that were both 0,0,0.So the offsetting became an issue

3 Likes

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