Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a character face in the direction of the camera?

Asked by 5 years ago

I'm using BodyGyro to rotate the player's character. The code below makes it so that the character faces where the camera is positioned. I'm trying to get the opposite effect, but having difficulty. I vaguely remember reading a question about this on here a long time ago, but I can't remember or find it with Google.

gyro.CFrame = CFrame.new(root.Position, Vector3.new(camera.CFrame.X, root.Position.Y, camera.CFrame.Z))
0
What do you mean `the opposite effect`? Vulkarin 581 — 5y

1 answer

Log in to vote
0
Answered by
Vulkarin 581 Moderation Voter
5 years ago

Oh I think I know what you mean, try this:

local pos = root.Position - Vector3.new(camera.CFrame.X, 0, camera.CFrame.Z)
gyro.CFrame = CFrame.new(root.Position, pos)
Ad

Answer this question