I imported animations that animated the character as well as the handle of a tool which is a descendant of the character.
In the animation editor, it works perfect, but when I try to use the animation in game, there are issues.
Here is the animation in the animation editor: As you can see the handle is animated as well as the character.
Here is the animation being played in game: The handle doesn’t seem to be animated properly.
This is the explorer and properties of the imported animated character
This is the explorer of the in game character (I set it up via script exactly the same)
As mentioned, I set it up in a script: Here is my code
--CreateMotor6D function
local function CreateMotor6D(part0: BasePart, part1: BasePart, motorName: string?): Motor6D
if not part0 or not part1 then
error("CreateMotor6D: part0 and part1 must be valid BaseParts")
end
local motor = Instance.new("Motor6D")
motor.Name = motorName or "Motor6D"
motor.Part0 = part0
motor.Part1 = part1
motor.C0 = CFrame.new(-0.03, -1.03, -0.028)
motor.C1 = CFrame.new()
motor.Parent = part0
return motor
end
--Code for setting up the cloned model
for _,inst in model:GetDescendants() do
if inst:IsA("BasePart") then
if inst == model.PrimaryPart then continue end
inst.CanCollide = false
inst.Massless = true
inst.Anchored = false
local weld = Instance.new("WeldConstraint")
weld.Part0 = model.PrimaryPart
weld.Part1 = inst
weld.Parent = inst
end
end
--Code which creates and parents the motor6d when the tool is equipped
--this is called prior to the animation playing!
--the tool and model is also parented to the character prior to this
if not self.Motor6D then
self.Motor6D = CreateMotor6D(character["Right Arm"],self.Model.PrimaryPart,"Handle")
end
self.Motor6D.Parent = character["Right Arm"]
Please let me know if you need any further code or information about what I am doing so you can help me solve this, thank you!