How to prevent the player from looking up and down (Y axis)

  1. What do you want to achieve?
    I would like to prevent the player from looking on the Y axis, but I want the X and Z axis to stay the same.
  2. What is the issue?
    010924128b5fc3d283b5af2c8d4bb356

This stuff in this video is exactly what im trying to achieve, but nothing seems to hit the mark.

  1. What solutions have you tried so far?
    I have tried restricting the field of view, setting the position of the camera relative to the player, but it doesnt work :confused: (And also looked through devforum)

I dont need the entire script or anything, i would appreciate it if you could tell me some ways on which i could approach this :slight_smile:

3 Likes

Two ways:

  1. Bind to render stepped , Last priority, and just force the pitch of the camera to 0 every frame. This is probably the easiest way, since ROBLOX will still handle all the different types of inputs for you.
  2. Make a LocalScript in StarterPlayerScripts called “CameraScript” and implement the entire camera script yourself. You can run a game first and see what the default one is, and then modify it to prevent y-axis. This is probably the “right” way, but it’s gonna take some work figuring out what ROBLOX’s monster of a script actually does.

Source: How do I prevent the player from looking up and down? - #7 by ArtFoundation

I had already seen this post, and unfortunately that doesnt seem to work :confused:

Have a look at this, I did something a while back with this camera way, and also changing movement controls to work properly
Custom player movement for isometric game - Help and Feedback / Cool Creations - DevForum | Roblox

It’s not copy locked so if you want you should be able to get to the code of this if it helps

1 Like

Thank you for the link :slight_smile: , but this isnt exactly what im trying to achieve , i would like the player to be allowed to change their camera angle on the X and Z axis, but i do not want them to change it on the Y axis, do you know how i could do this by any chance?

ok sorry, i maybe misunderstood from looking at the video!

I dont know if this is it but try looking at changing camera type to Enum.CameraType.Orbital

It looks as though it does what you want perhaps

1 Like

Oh yes! Thank you so much for this, i didnt even know about this, i spent more than 5 hours trying to come up with a way, and all i had to do was change a small setting :sweat_smile:

Thank you so much :slight_smile:

1 Like

No problem!

btw, if you want to change the zoom level looks like you just set the CameraMinZoom/CameraMaxZoom to something different it it should work with them

1 Like