How do force my character to face a certain direction?

So I’m making a horror game, and I have a camera system. I am planning to add an animation when the character enters the cameras. It would look pretty weird for example, if you were looking at a camera in front the computer. Here’s what happens.

sorry for the low quality, I think thats on roblox’s part.

1 Like

I don’t think it would look weird at all.
If you need to rotate the character, I think you can do

character:PivotTo(CFrame.Angles(0, rotation * math.pi/180, 0) * character:GetPivot())

To make the Character face a direction, you would set the CFrame of the Humanoid’s RootPart. This can be done with:

Character.Humanoid.RootPart.CFrame = your_desired_CFrame
1 Like

basically I mean it would look weird like this.
Screenshot 2023-11-17 203836
pretend this is in a sitting position.

anyway, what would the rotation value be?

I have a solution, this is how it looks: https://gyazo.com/2aab04c9a5dc6b5e6fb7d06abbae5ed0

i made a different script with different names but u should be able to change stuff

local thing = script.Parent.ProximityPrompt

thing.Triggered:Connect(function(plr)
	local char = plr.Character

	local rootPart = char:WaitForChild("HumanoidRootPart")

	if rootPart then
		local lookAtPosition = script.Parent.Position
		local newOrientation = (lookAtPosition - rootPart.Position).Unit
		rootPart.CFrame = CFrame.new(rootPart.Position, rootPart.Position + newOrientation)
	end
end)

mine isn’t working. It’s becuase the player’s camera mode is LockFirstPerson. Could I activate third person after clicking the prompt?

depends on ur camlock script, why not make a boolvalue store it somewhere and when the prompt is triggered then it sets it to true and then ur script gets disabled

isn’t LockFirstPerson a toggle? Where you have to do plr.CameraMode = Enum.CameraMode.LockFirstPerson or Enum.CameraMode.Classic?

I have never made a first person lock camera system thingy, so i dont know, mind showing the cam lock script?

this isnt the whole script but its the part that changes the CameraMode.

local player = game.Players.LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson

I don’t really understand the question but if you want to make the player face a certain direction, you just need to set Humanoid.AutoRotate to false (when set to true, the character rotates from walking and, in first person, moving the camera) and then setting the character’s CFrame.

Then when you want to unrestrict the character’s rotation set Humanoid.AutoRotate back to true.

2 Likes

Ooh! Cool! Thanks, I didnt realise it was that simple.

1 Like

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