How to know what the camera of the player is facing?

hai!

I am making a first person game and i want the arms to move with the camera, i want to do this by getting tge orientation of the camera but how do u get the orientation of the camera? I also want to have shiftlovk enabled (always) on a computer or a way so u can’t zoom out if that makes sense. Anyways i hope u can help!

2 Likes

For the zoom out problem, if you click on “StarterPlayer” in the explorer window, you can change the default camera type.

image

LockFirstPerson is what you need. Though people can change that on their own but honestly it shouldn’t really do any damage to your game.

1 Like

Are working on the first person aesthetic, if so you are doing it wrong I recommend you have look here

1 Like

Have you searched on the forum? :thinking:

1 Like

for some reason it won’t change the orientation?

part.Orientation = Vector3.new(game.Workspace.CurrentCamera.CFrame:ToEulerAnglesXYZ()

inside a localscript

Sigh, don’t do part.Orientation but part.CFrame

You’re attempting to compare a Vector3 with a CFrame value I believe

Try this?

local CamCFrame = CFrame.new(workspace.CurrentCamera.CFrame:ToEulerAnglesXYZ())
print(CamCFrame)

Part.CFrame = Cam.CFrame
1 Like

Isn’t CFrame also Position though?

CFrame contains both positional and orientational data while Vector3 - only positional.

If you use CFrame.Position/X/Y/Z, yes

I only want the orientation, the position is already done

You can do what JackScarlett said

It glitches out a lot and it won’t rotate with the camera

You might need to use RunService's RenderStepped event if you want the arms to move in a smooth way I persume?

1 Like

after a few seconds it deletes it? I tried using the head cframe instead, and it works. but it goes away after 3 seconds or so

You might need to use a WeldConstraint or a animation maybe? You could also refer to the post @CreepingGamingTV gave earlier

1 Like

The quickest google search will get you the answer. The accepted script:
image
(Remove the ``) at the end
will work for r6.
(Don’t use the my script is better for fps - it will glitch the char)

1 Like