Can't turn around my character without stopping their movement

Due to the nature of my game, I need to make a custom character control for it. It’s basically already done, however, the character stops moving and jags really weird everytime I turn around. I was turning around by directly setting the HumanoidRootPart CFrame, but I read something about AlignOrientation and attempted to use it. Sadly, still isn’t working.

My current code for setting my AlignOrientation is:

local char = script.Parent
local root = char:WaitForChild("HumanoidRootPart")
local part = Instance.new("Part")
local att = Instance.new("Attachment")
local align = Instance.new("AlignOrientation")
local weld = Instance.new("WeldConstraint")

part.Name = "RotationOrigin"
part.Size = Vector3.one * 0.25
part.Shape = Enum.PartType.Ball
part.Transparency = 1
part.CanCollide = false
part.CanTouch = false
part.CanQuery = false
part.CastShadow = false
part.Parent = char
part.CFrame = root.CFrame

weld.Name = "RotationWeld"
weld.Part0 = root
weld.Part1 = part
weld.Parent = part

att.Parent = part

align.Name = "Rotator"
align.Attachment0 = root:WaitForChild("RootAttachment")
align.Attachment1 = att
align.PrimaryAxisOnly = true
align.Parent = char

And I move the RotationOrigin like this:

if cam.X ~= 0 then
	rotator.CFrame = rotator.CFrame * CFrame.Angles(0, math.rad(-cam.X * 0.5), 0)
end

I’ve looked around and it seems that everytime the CFrame is set, the character will stop moving as position is updated. Isn’t there anyway to rotate the character without canceling Humanoid:Move()?

2 Likes

I understand that you are working with CFrame manipulation in the context of a physics system or character movement in some development environment. Using AlignOrientation is a useful technique for adjusting an object’s orientation in space, but it may need to be set correctly for it to work as intended.

Here is an example of how you can use AlignOrientation in Roblox (Lua) to adjust the orientation of a HumanoidRootPart:

  • – Assuming ‘humanoid’ is a reference to the character’s Humanoid

  • local humanoid = game.Workspace:WaitForChild(“YourCharacterName”):FindFirstChild(“Humanoid”)

  • – Assume ‘desiredOrientation’ is the desired orientation in CFrame

  • local desiredOrientation = CFrame.new(Vector3.new(0, 0, 0)) – Replace with desired CFrame

  • – Use AlignOrientation to adjust the orientation of the HumanoidRootPart

  • humanoid:Move(Vector3.new(0, 0, 0), desiredOrientation)

Do you have humanoid auto rotate turned off? That might be an issue from experience.

Otherwise, idk there might information thats missing here.

Edit: whoops typo I meant turnt off.

I don’t want it to auto-rotate it’s an FPS

What does the second parameter of :Move() does?

Just checked the edit, yes it’s off.

It is a method used to move an object such as a part, model or character to a new position in 3D space.

I know, I’m not really new to either scripting or programming in general. I was asking about the second parameter sent to Move()

I checked the docs and is a boolean, used to set if must be referent to the camera or not. In your example code u are sending a CFrame. Does it have more than one use? I can’t find anything about that in the docs.

Then the issue is probably something else. Is your custom character controller touching the ground?

Perhaps you can check out my custom character controller as it doesn’t have this issue and it also uses align orientation.

1 Like

Woah, cool guide and cool work! However I’m not sure if this is gonna work for me. My movement isn’t physics based and the reasons why I’m making my custom controller are the same reason it would be difficult to work with this. But thanks nontheless, I might take some code if I think it fits my needs.

My problem is on how could I rotate my character without setting the CFrame, because it will stop the current :Move()

I have the feeling I’m gonna have to play around the RunService and play the animations myself :C I wanted to try and hook the displacement part on Roblox’s default movement methods.

I see it might be just an odd humanoid bug/quirk.

Are you calling the Humanoid:Move() function once?

Perhaps even if it gets cancelled you can overwrite it in renderstepped like below and repeatedly call the humanoid:Move() function:

Oh ok that gives me an idea, I will make a “Dirt” system where everytime the character CFrame is rotated it sets a variable dirty, in the next physics frame it will update Move again if it’s dirty, lemme see if it doesn’t break anims or anything else.

No, it doesn’t work, how messed up it looked prommising.