How do I turn the player's camera sideways?

I want to turn the player’s camera sideways for an in-game effect

I just want to understand which value is responsible for this
In detail what I want to do:

3 Likes

You can rotate the camera on the Z Axis by setting the camera’s CameraType to Scriptable. You can do this by doing workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
After you’ve set the CameraType to Scriptable, follow this:

workspace.CurrentCamera.CFrame *= CFrame.Angles(0, 0, math.rad([ROTATION]) )

replace [ROTATION] with how much you want to rotate the camera.

2 Likes

It turns out like this right?
image
image
PlrCamera this is a camera

Yes, the PlrCamera should be workspace.CurrentCamera.
But note: you should only use this for cutscenes, or other similar things as your camera won’t move, so you’ll have to make a completely custom camera.

1 Like

For some reason it doesn’t work

I can give you a full script for you

Yes, just give me the whole script.

local IS = game:GetService("UserInputService")

local Plr = game.Players.LocalPlayer

local PlrCamera = game.Workspace.CurrentCamera

PlrCamera.CameraType = Enum.CameraType.Scriptable

IS.InputBegan:Connect(function(Key)
	
	if Key.KeyCode == Enum.KeyCode.A then
		
		print("PRESSED A")
		
		PlrCamera.CFrame *= CFrame.Angles(0, 0, math.rad(10))
		
	end
	
	if Key.KeyCode == Enum.KeyCode.D then

		print("PRESSED D")
		
		PlrCamera.CFrame *= CFrame.Angles(0, 0, math.rad(-10))
		
	end
	
end)
1 Like

As i said, the camera might freeze in place, so you’d have to write a completely new camera script.
Could you give me some footage of what happens? Are there any errors in the console?

1 Like

Well expect the video to load it’s still loading

1 Like

Ahaha i now i know what you want to do in game ; )

1 Like

The console just outputs Pressed d and pressed a and that’s it


The video is better not uploaded here

You could try this solution by @reimakesgames: Roll camera without scriptable Camera Mode - #3 by reimakesgames

1 Like

or maybe it’s because the player’s camera didn’t have time to load?

it worked! Only the camera is now just hovering in the air

That’s what i said - You’ll need to know how to make a custom camera script for your game.

1 Like

Unfortunately I don’t know how to do this :melting_face:

In order to tilt the camera, you need to give the camera a scriptable type and write a line of code game.Workspace.CurrentCamera.CFrame *= CFrame.Angles(0, 0, math.rad(10)) in this case, the player’s camera will hang in one place and it will not be possible to rotate it

Anyway, thank you so much for your help! Good luck in the development! :sunglasses: :ok_hand:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.