How to have the torso face the mouse on the z axis

I’m going for a look like this, this system I made however does not work too well.

It uses Motor6Ds to move the arms, head, and torso. (For the animations that it is being used with)

This system I made was temporary in the first place, so I will not be using it again, however, I do not have a good idea on how I would rotate the torso like this.

Any help is appreciated.

Boosting the post or something

--Assuming you already have the mouse position as Mouse.Hit.Position as 'pos'.
--Also, HumanoidRootPart is "root"

--Put the below as a variable:
local xy = Vector3.new(1,0,1)

--Put the below in your render stepped loop, with dt being delta time.

root.CFrame = root.CFrame:Lerp(CFrame.lookAt(root.CFrame.Position, (pos * xy)+(root.CFrame.Position*Vector3.yAxis)), dt * 10)

Simple enough.

It uses C0 and resets after unequipped, so this will not work unfortunately.

Ah, so you would need to set the C0’s cframe to the one I provided but in object space.

The old code I used was this, but since it wasn’t in object space it changed depending on the direction the player was facing.

character.HumanoidRootPart["RootJoint"].C0 = character.HumanoidRootPart["RootJoint"].C0:Lerp(CFrame.Angles(0,0,math.rad(180))*CFrame.Angles(math.rad(90),0,math.asin((mouse.Origin.p - mouse.Hit.p).unit.x)),0.1)

I will try this. charlimit lol

You might have an issue if the player moves in another direction with the character though. It would work, but it might be slow with lerp.

How do I change it to ObjectSpace again? Its been a while since I had to do this.

You might want to do yourCFrame:ToObjectSpace(root.CFrame) or if that’s inverted do root.CFrame:ToObjectSpace(yourCFrame).

What is “yourCFrame”? charlimit

For further reference, it’s more of something like this that I want, how the torso moves like this:

this:

or this:

That one looks to manipulate the root’s CFrame, not the Motor6D.

Define “that one” please. charlimit

Is “that one” this video here?

The one in the video. It doesn’t seem to manipulate Root.C0/C1.

You know what, I’m stupid, this whole time I could have just manipulated the Root’s CFrame instead of C0 and then stopped changing it once unequipped… Bruh.

1 Like

Don’t forget to disable Humanoid.AutoRotate. I had it on once and it caused issues, but I couldn’t figure out the problem for an hour.

I forgot about that lol. Thank you for reminding me!

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