So I’ve tried porting a camera system from one of my old Unity projects into roblox. Now that code was pretty buggy off the bat so I decided to scrap it and make a first person scripted camera for roblox and this is the code i’m using:
Now I know the problem is caused by roblox’s weird input system (compared to unity) where the coordinates of the mouse start at the very left and bottom (i think) of the screen. I just don’t know any work arounds since there are no tutorials or guides to make these cameras online
The player’s Humanoid’s AutoRotate relies on the camera (which is why there’s a 0.5 stud minimum distance between the player’s Head and Camera in first person). With the Camera at the pinpoint center of the Head, the AutoRotate gets bamboozled and spins the player erratically.
If you were to change the behavior of the FPS camera, you’ll probably have to create your own AutoRotate too.
The question is how do I disable it. Also there exists the problem of the weird mouse behaviour. If you look at the clip I sent (You might have to click it), you can see that the mouse doesnt act as a mouse but more a “slider”. I need to worry about that too.
-- Assuming you localized (or assigned to a variable) Players service...
local humanoid = players.LocalPlayer:WaitForChild("Character"):FindFirstChildWhichIsA("Humanoid")
humanoid.AutoRotate = false
You can lock the mouse using the UserInputService. You can set its MouseBehavior to Enum.MouseBehavior.LockCenter so it stays in the center of your screen. This service also provides :GetMouseDelta(), basically the “velocity” of the mouse when it is locked.