I want the entire character to face the same direction that the camera is facing while the player is holding a button. While rotated, moving the character around should feel as natural as normal
The movement while walking around and jumping works perfectly, but my issue is that while standing still it does a weird jittering thing. It is also terrible for aiming attacks as it does not face exactly where the camera is facing
My other method was to just update the CFrame using CFrame.lookAlong every heartbeat. It reduces the jittering issue and is a bit better for aiming, but now it messes up the movement, especially when jumping: https://gyazo.com/3a3ca65c57e38367b6e7dd66edb85323 (i am not pressing WASD while rotated during this gif, but while on the floor it moves on its own. and then when i jump, suddenly im on the other side of the world)
I’ve looked around here and I don’t think anyone else, ever, has tried to make the same thing as me so I can’t find a solution. I’ve only found questions on how to make the character follow the camera horizontally but not vertically…
What is a method of doing this that has none of my ones’ issues? if u need any extra information ill try to provide it
It’s crazy that I found the answer just 20 minutes after posting this, after having made the feature months ago. it turns out u ARE meant to use align orientation
here is my code, which i didnt think about too much since it was just for testing:
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")
local alignOrientation = script:FindFirstChild("AlignOrientation"):Clone()
alignOrientation.Attachment0 = rootPart:WaitForChild("RootAttachment")
local camera = workspace.CurrentCamera
while true do
if alignOrientation.Parent ~= rootPart then
alignOrientation = script:FindFirstChild("AlignOrientation"):Clone()
alignOrientation.Parent = rootPart
alignOrientation.Attachment0 = rootPart:WaitForChild("RootAttachment")
end
if game.UserInputService:IsKeyDown(Enum.KeyCode.E) then
alignOrientation.CFrame = CFrame.lookAlong(rootPart.Position, camera.CFrame.LookVector)
else
alignOrientation:Destroy()
end
RunService.RenderStepped:Wait()
end
here is another script you need to make it work, otherwise roblox ragdolls u when u look down (i already had this, it wasnt a new discovery)
local stateType = Enum.HumanoidStateType
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
humanoid:SetStateEnabled(stateType.FallingDown, false)
humanoid:SetStateEnabled(stateType.Ragdoll, false)