Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to vertically lock the camera angle, but not horizontally?

I'm trying to make a dungeon game where the camera of a player can't zoom in or out (I've already done that part) but I need to make it so shift lock is always enabled (I can probably do that on my own as well)...

But I'm trying to make it so the player's camera angle can move left/right but not up/down, kind of like the "Orbital" roblox camera setting, the only problem is I'm trying to make the game a top down shooter, but I can't set the camera angle in the Orbital view.

I'm sure there is a simple way to vertically lock a camera angle, but I can't find it in the playersettings, there is only min/max zoom, what do I do?

For reference, the camera idea I'm going for is similar to this game's camera. https://www.roblox.com/games/9207492417/Rogue-Nightmare

1 answer

Solution 1

If you want to activate automatically when a Player joins, you can change StarterPlayer.DevComputerCameraMovementMode to Orbital. For mobile devices, you can change StarterPlayer.DevTouchCameraMovementMode to Orbital. Solution 2

If you want to set the player's camera mode to Orbital when triggered by an event, you can change Player.DevComputerCameraMode to Orbital. For mobile devices, you can change Player.DevTouchCameraMode to Orbital.

For example, you want to set the player's camera mode to Orbital when clicking a button.

-- LocalScript inside the button
local button = script.Parent
local orbital = false

local Players = game:GetService("Players")
local player = Players.LocalPlayer

button.MouseButton1Click:Connect(function() -- when the button is clicked using the left mouse button (common)
	if orbital then -- if camera mode is in orbital
		orbital = false
		
		player.DevComputerCameraMode = Enum.DevComputerCameraMovementMode.UserChoice -- sets it back to normal (computer devices)
		player.DevTouchCameraMode = Enum.DevTouchCameraMovementMode.UserChoice -- sets it back to normal (mobile devices)
	else
		orbital = true
		
		player.DevComputerCameraMode = Enum.DevComputerCameraMovementMode.Orbital -- sets it to Orbital (computer devices)
		player.DevTouchCameraMode = Enum.DevTouchCameraMovementMode.Orbital -- sets it to Orbital (mobile devices)
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.