What do you want to achieve?
I’ve been trying to make an animation system on a viewport frame. I managed after a ton of tries to finally make it work. Now it works fine but if someone put his game to a lower quality (roblox settings), the animation plays in low FPS.
What is the issue?
The animation plays in lower FPS and I can’t ignore mobile or low budget devices.
What solutions have you tried so far?
I’ve tried checking on the forum and I searched on google, didn’t find anything. I know there’s a way to fix it since I saw a random anime tower defense game have the same bug and they fixed it.
This is my code, Before all that it’s basically cloning character from the replicatedStorage, clone it in the workspace, and each frame the workspace is sending the body parts to the WorldModel:
if hrp then
-- Delta and start
local delta = 0.0001
currentRenderConnection = runService.Heartbeat:Connect(function()
if hrp.Parent then
-- Toggle CFrame back and forth foricng a render update
if hrp.Position.X == 0 then
hrp.CFrame = CFrame.new(delta, 0, 0)
else
hrp.CFrame = CFrame.new(0, 0, 0)
end
else
currentRenderConnection:Disconnect()
currentRenderConnection = nil
end
end)
end
Your animation updates are tied to Heartbeat which runs at the client’s FPS. Low settings = low FPS = choppy animation. Use RenderStepped instead of Heartbeat, it updates every visual frame.
I’d imagine this is just an engine optimization. With lower graphics, its safe to assume the user is on a low-end device, and thus since each ViewportFrame is a new renderer, the engine will lower the framerates of them to avoid overloading the CPU or GPU.
RenderStepped also runs every frame. The only difference between Heartbeat and Renderstepped is that Heartbeat runs after the frame has been rendered.
how come youre parenting the rig into workspace and not the worldmodel? the worldmodel instance exists for this
i tried to recreate your problem before realizing your method, animations work perfectly fine in worldmodel
I tried to parent it to the worldmodel but it simply didn’t work for some reason. Had to find another way and it was the only one I found. I don’t think it’s the most optimal, do you think I should change the core logic?
your method is a little hacky, itd be for the best
are you sure you set the script and worldmodel up properly when you initially tested it?
however if you dont want to change your core logic, i believe your issue has something to do with StreamingEnabled, if you set the rigs’ character to persistent it may fix it