Trying to make the torso face the mouse

Hey devforum, I’m having some trouble making the torso follow the mouse.

It works well until the mouse goes behind the character.

https://gyazo.com/0437ae2b521b0e283307bbb7baed3892

This is how I am rotating the torso:

local mouseDirection = character:WaitForChild("HumanoidRootPart").CFrame:VectorToObjectSpace((mouse.Hit.Position - character:WaitForChild("HumanoidRootPart").Position).Unit)
local mouseX = mouseDirection.X
local mouseY = mouseDirection.Y
waist.C0 = CFrame.new(0, waist.C0.Y, 0) * CFrame.Angles(0, -mouseX, 0) * CFrame.Angles(math.asin(mouseY), 0, 0)

Are you looking for something like this where the character tries to look behind them?

1 Like