I’m having issues with my walking animations jittering. It seems like only the forward animation is not jittering. I don’t think any of my animations are overlapping either so I have no idea what is causing this.
function PlayAnimation(AnimationTable: AnimTable, Direction)
if CurrentAnimation ~= AnimationTable.ID then
CurrentAnimation = AnimationTable.ID
print(Direction)
if CurrentTrack ~= nil then
CurrentTrack:Stop(TRANSITION)
end
CurrentTrack = TRACKS[Direction]
Humanoid.WalkSpeed = AnimationTable.WalkSpeed or DEFAULT_WALKSPEED
CurrentTrack:AdjustSpeed(AnimationTable.Speed or 1)
CurrentTrack:Play(TRANSITION)
-- if CurrentKeyframeHandler ~= nil then
-- CurrentKeyframeHandler:Disconnect()
-- end
-- CurrentKeyframeHandler = CurrentTrack.KeyframeReached:Connect(onKeyframeReached)
end
end
function onRunning()
local Direction = calculateRelativeDirection(workspace.CurrentCamera, Humanoid)
local Animation = ANIMATION_IDS[Direction] :: AnimTable
PlayAnimation(Animation, Direction)
end
function MovementController.KnitStart()
Trove:Connect(Players.LocalPlayer.CharacterAdded, function(Character: Model)
Humanoid = Character:FindFirstChildOfClass("Humanoid") :: Humanoid
end)
-- load animation tracks
for Direction, _ in DIRECTION_VALUES do
if not ANIMATION_IDS[Direction].ID then
warn(`[{Direction}] does not have an Animation ID`)
continue
end
local AnimationID = ANIMATION_IDS[Direction].ID
local Track = Instance.new("Animation")
Track.AnimationId = AnimationID
local LoadedAnimation = Humanoid:FindFirstChildOfClass("Animator"):LoadAnimation(Track)
LoadedAnimation.Priority = Enum.AnimationPriority.Movement
TRACKS[Direction] = LoadedAnimation
end
Trove:Connect(Humanoid:GetPropertyChangedSignal("MoveDirection"), onRunning)
Trove:Connect(Humanoid.Running, onRunning)
end