Whenever the player hits a wall it “trips” / spins around chaotically. How can I lock the X and Z axis of the Humanoid Root Part’s orientation? I tried using Align Orientation and setting the player’s orientation in a RunService.Stepped loop, but Align Orientation only rotated it in one direction and setting the player’s orientation, for some reason, also set the player’s position.
Not exactly sure what you’re asking for but, I would start by making a server script inside of server script service and then you could maybe constantly set the X/Z values in the orientations vector to zero like shown:
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
while true do wait()
local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
humanoidRootPart.CFrame.Orientation = Vector3.new(0, humanoidRootPart.CFrame.Orientation.Y, 0)
end
end)
Haven’t tested, so you can do that and try solve the issue if it doesn’t work…
Portion of the Code is taken from my previous post of a CFrame rotation method to align Vectors.
--Place in StarterCharacterScripts
local humanoidRootPart = script.Parent:WaitForChild("HumanoidRootPart")
local randomAxis = Vector3.new(1,0,0) -- Read this in the EgoMoose article
local function getRotationBetween(u, v, axis)
local dot, uxv = u:Dot(v), u:Cross(v)
if (dot < -0.99999) then return CFrame.fromAxisAngle(axis, math.pi) end
return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot)
end
while true do
humanoidRootPart.CFrame = getRotationBetween(humanoidRootPart.CFrame.UpVector, Vector3.yAxis, randomAxis) * humanoidRootPart.CFrame
local dt = task.wait()
end
Well, even with render stepped, it’s jittery. Setting the rotation at all is jittery and that’s why I thought of using constraints like Align Orientation, which are smoother. Either there’s no way to do it with Align Orientation, or I just don’t know how to use it. I’m also kinda new to using constraints.
You’re probably asleep, but for anyone reading this, am I supposed to use this or use a part of this? In the post, it uses Align Orientation, but I still don’t understand how it works. Can anyone explain?
No loop where it sets the orientation works. Is there any way to make it smooth using Align Orientation? I was thinking it had to do with Primary Axis and Secondary Axis, but I don’t understand how it works. You have any ideas?
To combat this issue in Claw In The Chamber I used a method where you disable all Humanoid state types related to Ragdolls.
I never experienced Players falling over, or flopping to get back up on their feet. Instead whenever they hit an object hard the wall pushes them back a bit and does not cause a ragdoll. They always are upright on their feet.
Basically what @SubtotalAnt8185 said but hopefully the extra details help.