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:
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
So my question is:
Does anyone know how it is makeable?
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.
ups, google tranlator is not a good platform to translate 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:
The player can rotate his camera 360°degrees around the player on the blue axis
The player can rotate only 90°degrees aroung the player in the black axis.
The red line is like a invisible wall for the player, where they can’t turn the camera 360°degrees.
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:
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:
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 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.