How do I make the camera not pitching up/down?

Hello community,
I am testing since days for this and I don’t come to a solution.
My Goal is: the player camera not pitching up / down. So the camera can rotate 360° degress around the player in any direction.
Here an video to show what I mean with pitching upside / downside:

Click me to see the video! (This link goes to cloudconvert.com) (imgur didn’t worked)

What I tried is:

  • I checked the API and articles of Roblox Hub, I checked Devforum sites…
  • I made a script, where I put the camera subject to the players head and one time on a part inside the players head, but I always had the problem that the camera stops up/down.
  • I tried to bring the 360° degrees rotation with CFrames like it is used at viewport frames.
  • I tried to use orbital camera, because in the Devhub was written,that it has no pitching up/down. It didn’t worked too.

I played a game that has this “not pitching up/down”. I wanted to implement the gamelink here, but I didn’t found it in my “played-list”, because it was too long ago :confused:

So my question is:
Does anyone know how it is makeable?

I just set the cameras CFrame and and set the angle of what ever direction you don’t want moved to 0.

I will try it, thanks
But what angle (angle of what exactly) do you mean? You mean the camera subject?

nope, I tried and I was not able.

“You don’t want moved”. I want that the camera looks in any direction controlled by the player.

you have to set the cameraType to Enum.CameraType.Orbital. If it is not working, make sure its in a local script.

All scripts that have to do with camera I placed as localscript inside Starterplayer->StarterPlayerScripts
I tested often with orbital.
But my problem is, I can move the camera in orbital mode only to left right not up down and I can scroll in and out.

you said you only wanted to be able to move it left/right, not up down. So you only want to move it up/down, and not left/right?

ups, google tranlator is not a good platform to translate :sweat_smile: or I explained wrong.
So I want that the camera goes left & right and up & down like in the classic camera view.
Here a bad drawing of the player camera and his moveable axises:

  1. The player can rotate his camera 360°degrees around the player on the blue axis
  2. The player can rotate only 90°degrees aroung the player in the black axis.
  3. The red line is like a invisible wall for the player, where they can’t turn the camera 360°degrees.
  4. The two little black arrows (with the green missing term) are not existing for the camera. This means, the camera doesn’t turn around it / doesn’t move along them.

Here is an image of how it was looking like in the game that I played:

I hope it is now understandable, if not, then be free to say it. Meanwhile I search for the game on roblox

change workspace.CurrentCamera.CameraType to Enum.CameraType.Scriptable, then set the workspace.CurrentCamera.CFrame to a CFrame. If you want to visualize what the cframe will be, you can use the cframe of a part:

workspace.CurrentCamera.CFrame = workspace.Part.CFrame
1 Like

I startet new with my script and worked with your guide.
After 2 hours of painfull testing and scripting I got it!
Here is the script that makes your camera rotate in any direction, 360°degrees!

Put this script as localscript inside StarterPlayer -> StarterPlayerScripts

local player = game:GetService("Players").LocalPlayer
local character = player.Character
if not character or not character.Parent then
	character = player.CharacterAdded:wait()
end
local camPart = character:WaitForChild("Head") --("HumanoidRootPart")
local camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")
local mouse = player:GetMouse()

workspace.CurrentCamera.Focus = camPart.CFrame
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CameraSubject = camPart -- This does nothing, I don't know why :(

game:GetService('UserInputService').InputChanged:connect(function(inputObject) -- Mouse controll to allow a player to move inside "Scriptable" mode
	if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
		if Button2Down then
			game:GetService('UserInputService').MouseBehavior = Enum.MouseBehavior.LockCurrentPosition -- Setting to Default destroys the script!
			camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(-inputObject.Delta.y/25), math.rad(-inputObject.Delta.x/25),0) -- Hearth of the script

		else
			game:GetService('UserInputService').MouseBehavior = Enum.MouseBehavior.Default -- I think i will remove this, or do something else with it
		end
	end
end)

mouse.Button2Down:connect(function() Button2Down = true end)
mouse.Button2Up:connect(function() Button2Down = false end)

With this script everthing worked!
But there is still a problem:
The camera is in the sky and not at the player.
I tried to put it to the head of the player, but it destroyed the 360°degree feature.

I hope someone knows how to fix it. :wink:

set the cframe to the player’s head as soon as the script executes

I tried it.
The line:
workspace.CurrentCamera.CameraSubject = camPart
camPart is the players head.
If I set it, then the 360° degree rotation doesn’t work and the camera gets always stuck.

I am trying and trying and it doesn’t work.
Now I try to make a basepart the camerasubject instead of a player. Let’s see if the script doesn’t want to work at all or only at specific conditions.

1 Like