-
What do you want to achieve?
How to orient the player to the camera orientation ? -
What is the issue?
The character does not orient to the camera orientation ! -
What solutions have you tried so far?
I’ve searched a while and I have found anything that reply to my problem …
1 Like
Try this code, put it in local script
wait(3)
local player = game.Players.LocalPlayer
print(player.Name)
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Attach
1 Like
Thank you for the reply !
But that’s not what I want, I want to know how can I rotate the player when my camera rotate !
Sorry for my bad english …
Did you mean something like this?
wait(3)
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local rootPart = player.Character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
camera.Changed:Connect(function()
local cameraDirection = camera.CFrame.Rotation
local rotX,rotY,rotZ = cameraDirection:ToEulerAnglesYXZ()
local rootPartPos = rootPart.CFrame.Position
local RootRotX,RootRotY,RootRotZ = rootPart.CFrame:ToEulerAnglesYXZ()
print(cameraDirection)
rootPart.CFrame = CFrame.new(rootPartPos)*CFrame.Angles(RootRotX,rotY,RootRotZ)
end)
2 Likes
Thank you so much that totally what I want !
Have a nice day !
No problem! Can you set it as solution so new people will see what was the key?
Ugh, i didn’t see that is set as solution, my bad!
Have a nice day too!
2 Likes