AlOrient.Mode = 0
AlOrient.Attachment0 = Character.HumanoidRootPart.CharFloorAttachment
AlOrient.PrimaryAxis = Vector3.new(1,0,0)
AlOrient.SecondaryAxis = Vector3.new()
AlOrient.Responsiveness = 10
AlOrient.MaxTorque = math.huge
local TargetCFrame = CFrame.fromMatrix(PrimaryPart.Position * Character.Humanoid.HipHeight, Tangent, Normal, Binormal)
AlOrient.CFrame = TargetCFrame
AlOrient.Parent = PrimaryPart
If you put this in StarterCharacterScripts it should turn the character 90 degrees when they spawn, you can probably manipulate it to work for yours pretty easily.
local char = script.Parent
local HRP = char:WaitForChild("HumanoidRootPart")
local align = Instance.new("AlignOrientation")
align.Attachment0 = HRP:WaitForChild("RootRigAttachment")
align.PrimaryAxisOnly = true
align.Mode = Enum.OrientationAlignmentMode.OneAttachment
align.Parent = HRP
local goalOrientation = Vector3.new(0,0,math.rad(90))
align.PrimaryAxis = goalOrientation
Doesnt rlly solve my issue, im tryna make my code work withought making the Align Orientation affect the Y axis, because putting torque on y axis breaks Auto Rotate. Basically, i just want align orientaion to rotate X and Z but ignore and dont put any torque on Y.
Wait so, what axis do you want the character to rotate on? I’m not quite following.
I want to be able to manipulate character left and right tilt and forward and back lean withought applying torque to the Y axis, which is left and right turn i believe, so that when i manipulate the tilt and lean, the “Auto-Rotate” feature, which rotates ur character in the direction ur walking, still works.
You could try patching the Motor6D joints in real-time.
Here’s a really bare-bones client-side only example for R15:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local function update()
local player = assert(Players.LocalPlayer)
local character = player.Character
local upperTorso = if character
then character:FindFirstChild("UpperTorso")
else nil
if upperTorso and upperTorso:IsA("BasePart") then
local rootPart = character.PrimaryPart
local waist = upperTorso:FindFirstChild("Waist")
if rootPart and waist and waist:IsA("Motor6D") then
local camera = workspace.CurrentCamera
local cameraCF = camera.CFrame
local camLook = cameraCF.LookVector
local camRight = cameraCF.RightVector
local rootLook = rootPart.CFrame.LookVector
local pitch = rootLook:Dot(camRight)
local yaw = camLook.Y
local waistPos = waist.C0.Position
waist.C0 = CFrame.Angles(yaw, pitch, 0) + waistPos
end
end
end
RunService.Heartbeat:Connect(update)
Nope, forgot to mention we are using custom mesh deformation chars
Try patching the rotation/transform of a bone with a similar strategy?
Is there a way to do this via rotating the HRP rather than a motor6d or bone?
If you try to rotate the HumanoidRootPart directly you’ll be fighting against the Humanoid’s PID controller attempting to keep it up-right. It would be better to rotate some joint or bone that is connected to the HumanoidRootPart instead.