Hey so as the title says I’ve been trying to make the player character stop from spinning too fast and have a maximum angular speed. I’ve tried using the AlignOrientation, it works correctly but it glitches when the player touches a wall.
Here’s a video of what I don’t want to it happen:
I’ve also looked other posts and saw nothing useful. Any ideas of how can I achieve it?
First off, you can see how fast the character is actually spinning by simply checking the orientation magnitude of the torso, and seeing how fast it moves. I wouldn’t know how to limit it, though.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local prev = character.HumanoidRootPart.CFrame.LookVector
while task.wait() do
print((character.HumanoidRootPart.CFrame.LookVector-prev).Magnitude)
prev = character.HumanoidRootPart.CFrame.LookVector
end
end)
end)
My guess would be to set the CFrame back to where it previously was, so it locks the player if it rotates quickly next frame.
A quick explanation of how it works:
First, you have to disable AutoRotate of the character’s Humanoid.
Second, create an attachment on the HumanoidRootPart and set it to be the Attachment0 of the AlignOrientation.
Lastly, with a RunService.RenderStepped event you have to be changing the AlignOrientation.CFrame if the player is moving or is in first person/shiftlock, and if the player stops one or both actions, you set back the AlignOrientation.CFrame to the Attachment0.WorldCFrame.
Thanks! I tried modifying your script but it always turned out to be really glitchy and couldn’t solve the problem. I managed to get it done with an AlignOrientation which I said it doesnt work 100% of the time but I think I used different settings in the old script but it works now so thanks