I’m currently developing a grid-based building system that involves breaking and placing blocks (should sound familiar). However, I’m faced with a problem: the default camera script locks the camera to rotating no further than 80 degrees vertically in either direction. As I understand it, this is to prevent unintended behavior. But this restriction makes it next to impossible for the player to place blocks directly above or below them, as the camera cannot reach the full 90 degree rotation. I’ve searched for solutions to this issue, but the best information that I’ve found comes down to “script an entire custom camera system.” Of course, I’m not looking to be spoon-fed, so I’ll pose my question as follows:
Is there any approach I can take that simply involves modifying the default camera script rather than writing a system from the ground up?
If not, what resources/advice would you give to this end?
You could just load up a test in studio, go under StarterPlayerScripts >PlayerModule>CameraModule> Base camera and change
local MIN_Y = math.rad(-80)
local MAX_Y = math.rad(80)
to 90 for both values. Then when a player joins, delete the default base camera script and insert your own.
Then you could make a local script, and insert it into StarterPlayerScripts, place your new Base Camera script under the local script as child and have your local script read something like this
local currentbasecam = game.Players.LocalPlayer.PlayerScripts.PlayerModule.CameraModule.BaseCamera
local newbasecam = game.Players.LocalPlayer.PlayerScripts["New base cam"].BaseCamera:Clone()
currentbasecam:Destroy()
newbasecam.Parent = game.Players.LocalPlayer.PlayerScripts.PlayerModule.CameraModule
script:Destroy()
Not sure if this will work if the player is already spawned in or not, but you can fiddle with this as you can use this method to edit the default camera scripts.
Edit: If it doesn’t work since the player is already loaded you might try inserting the entire player module, I know this sounds like a lot but there is a script that goes into the player when they join that will require that the player scripts to be there, so just a thought.
1 you can simply copy the player module, paste it into studio under StarterPlayerScripts and edit what you want in the modules since it will use any module there called PlayerModule instead of putting one there if one exists
2 the code itself says that going beyond 81.89 degrees makes the camera unstable so unfortunately its not that practical to just unlock it, youll have to make your own special code to do it