Best method for vertically rotating the entire character?

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

I’ve tried many methods and the best one I found was to use bodygyros. While they’re deprecated, I simply don’t believe AlignOrientation can do the same thing and I don’t think there’s a replacement. I update the bodygyro every heartbeat to make it look along the lookvector of the camera. This is what it looks like with bodygyros: https://gyazo.com/2b7d6815f4ac0928717544262fe7ff00
https://gyazo.com/7e7255891d4fb8faaac802a8d80bed66
https://gyazo.com/6b3967622e66f620b14f267f069eec06

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

1 Like

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’s how it looks: https://gyazo.com/07d0df410739361164d1ccc3e232cf3d

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)

They’re both local scripts in starter character

Here are the properties of the AlignPosition

THATS ALL

Also I wanna know if anyone ever actually needs this

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.