Creating the opposite of humanoid auto-rotate?

I’ve been trying to “reverse” Roblox’s default humanoid auto-rotate, but I can’t figure out how. I searched in Roblox API, Roblox dev forum, and google for 2 days now, trying to find the default auto-rotate script at least so I can break it down, but I didn’t find anything.

If I’m not being clear with “reversing” Roblox auto-rotate here are some examples:

Roblox default auto-rotate

What I want to achieve, but with humanoid.MoveDirection

In this example, I basically set HumanoidRootPart CFrame to point at the camera focus.

So, you may be asking yourself, if I already made it, then why use a “reversed auto-rotate”? Well, there are two reasons:

First: when moving back to left or right the character will not point his back to it, creating this weird movement (I’m moving diagonally in the video):

Video

Second: as shown in the first video on this topic, the Roblox default auto-rotate creates a little delay for the character to point to move direction, a kind of cool effect. I know it could be done with CFrame manipulation but that’s not the point here.

Roblox auto-rotate but when going backward (What I want to reverse)

So, is there any way to create a “reversed auto-rotate”, like, instead of pointing the character’s front to walking direction, pointing his back? How would I do this?

If I’m not being clear or you need some kind of information about the problem let me know.

1 Like

You can accomplish this by simply rotating the root weld by 90 degrees on the Y axis (or whatever axis is facing up).

Oh, sorry for being late, I had to sleep.

Anyways, I didn’t find any weld on the root part or connected to it, if you meant motor6D then there are two main problems:

  1. I don’t know how to rotate a motor6d properly

  2. If I rotate it by 90 degrees the character will point his back to move direction only when going forward, I’m trying to achieve something like the second video in the topic, but with moving direction so that I don’t need to create whole new animations for back left and back right.

(I already made animations for the back left and right but they were basically the back
walking one I made but rotated 45 and -45 degrees, and when mixing them together they look pretty weird.

So, because they are all the same animation I just wanted to automatize the process and make it look better just by creating this “reversed” auto-rotate.)

unsure of whether this will help, but in player.Character.Humanoid there is a property called auto-rotate, it can be set to true (where, unless shiftlocked, character will face the direction hes moving) or false (i tested this, the character will face the same way he was facing before you turned auto-rotate off. this applies to zooming in and rotating camera, and i believe shiftlock)

also perhaps try rotating the humanoid root part by 180 degrees along the up-down (y) axis?

I know about this property, I also mentioned it in the post.


This was already suggested by SubtotalAnt

And I explained why I didn’t use this solution here:

Edit: Again, sorry for the late answer, I was in school.

Humanoid movement is built into the engine.

I believe its so they can take advantage of the 240 hz physics engine.

Otherwise I recommend scripting your own to reverse it. Here is mine look at the AutoRotate module script which uses align orientation in the CFrame.loolkAt towards the move direction. You probably can just add a negative sign to reverse it:

2 Likes

I tried to extract only the auto-rotate part of it, but for some reason, it only works in a 180-degree angle:

Is it in object space? Or, is it relative to the move direction?

1 Like

Bruh I slept again, sorry

The move direction is in world space, if that’s what you are referring to.

Yeah, I think it might need to be in object space, or at least relative to the humanoid’s move direction.

Do you mean like this?

local moveDir = root.CFrame:vectorToObjectSpace(humanoid.MoveDirection)
if moveDir.Magnitude > 0 then
	alignmentAttachment.CFrame = CFrame.lookAt(Vector3.new(0,0,0), moveDir)
	alignOrientation.Enabled = true
end

I tried this and it doesn’t look right

Didn’t seem to solve the issue. What is the alignmentAttachment’s mode set to?

The default 2 attachments mode

What are they set to? What’s the 2nd attachment?

I just followed dthecoolest’s code (the auto-rotate part of it) at the start of this video you can see it:

	local root = character:WaitForChild("HumanoidRootPart")
	local humanoid = character:WaitForChild("Humanoid")
	humanoid.AutoRotate = false
	
	local attachment = Instance.new("Attachment")
	attachment.Parent = root
	
	local alignmentAttachment = Instance.new("Attachment", game.Workspace.Terrain)
	local alignOrientation = Instance.new("AlignOrientation")
	alignOrientation.Parent = character
	alignOrientation.Attachment0 = attachment
	alignOrientation.Attachment1 = alignmentAttachment

Try changing it to World instead of TwoAttachment. That will make it in world space.

Then, adjust the CFrame of the AlignOrientation.

The only available modes are OneAttachment and TwoAttachment

Oh, I thought it was Mode. Change RelativeTo to OneAttachment.