So, I have a game which contains lots of animations which heavily move your torso during them, and that part is fine. However, Moving the humanoidRootPart using CFrame will result in unnatural changes to the character’s physics, which really ruin the experience. I’ve yet to capture a full on video of the event happening in my game (my duct tape fix works with people on average ping, so I dont have footage of it right now.)
Update 1: My friend clipped it happening for me, and I’ve attached that now.
The issue mainly stems from stopping the animation and moving them to a specific location, which changing the cframe does fine. I wish to find a fix to the velocity issue, even if it happens for a little a longterm fix would be lovely. Any way to detect it would be good at this rate
I have no real idea on how to detect when the weird velocity bug is occuring (because it could range from very minimal things like being unable to move left while jumping). My “duct tape fix” is just anchoring and unanchoring, which does “fix” the issue, but high ping players are still out of the loop.
Update: I finally discovered how to detect said issue!
When your character is in a state where they shouldnt have offset (for my case, its being not anchored wtih rootpart)
Read their HumanoidRootPart’s AssemblyCenterOfMass, and when its offseted, the difference will be big.
I did a magnitude check between AssemblyCenterOfMass and the RootPart’s Position, which got me a number to use. For me, anything above 0.8 was weird offset issues, so I made it quickly fix said issue. Works like a charm now!
I’ve had people reach out, so here’s the code snippet.
(This method isnt optimal, if you find other ways of balancing out mass, please sub it out instead of this.)
LocalScript in StarterCharacterScripts:
local RunService = game:GetService("RunService")
local Character = script.Parent
local HumanoidRootPart : Part = Character:WaitForChild("HumanoidRootPart")
local FixCooldown = false
local FixTick = nil
RunService.RenderStepped:Connect(function()
if (HumanoidRootPart.AssemblyCenterOfMass - HumanoidRootPart.Position).Magnitude >= 1 then
if FixCooldown == true and (FixTick and tick() - FixTick >= 0.5) then
FixCooldown = false
FixTick = nil
end
if FixCooldown == false then
FixTick = tick()
local anchored = HumanoidRootPart.Anchored
if anchored == false then
HumanoidRootPart.Anchored = not anchored
task.wait()
HumanoidRootPart.Anchored = anchored
end
end
end
end)