Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to flip the in-studio camera with CFrame in studio? (SOLVED BY ME)

Asked by 4 years ago
Edited 4 years ago

So, I'm currently working on a plugin that makes it easier to make cutscenes. But, I ran into a problem. For this to work I need to be able to rotate the in-studio camera. I have this code:

while rotate do
    game.Workspace.Camera.CoordinateFrame =                                  
    game.Workspace.Camera.CoordinateFrame* CFrame.Angles(0, 0, math.rad(180))
    RunService.RenderStepped:wait()
end

But all it does is make an endless loop of it going upside down and up again. Is there another script preventing this from happening. idk plz help!

ANSWER: The problem was the Camera type had to be set to fixed!

WORKING CODE:

local RunService = game:GetService("RunService")

game.Workspace.Camera.CameraType = Enum.CameraType.Fixed
while rotate do
    game.Workspace.Camera.CoordinateFrame =                                  
    game.Workspace.Camera.CoordinateFrame* CFrame.Angles(0, 0, math.rad(180))
    RunService.RenderStepped:wait()
end
game.Workspace.Camera.CameraType = Enum.CameraType.Custom

SIMPLIFIED CODE:

    game.Workspace.Camera.CameraType = Enum.CameraType.Custom
    game.Workspace.Camera.CoordinateFrame =                         game.Workspace.Camera.CoordinateFrame* CFrame.Angles(0, 0, math.rad(num))

by: @BongoCatJoosan

1 answer

Log in to vote
0
Answered by 4 years ago

the working code will work even when its off so you can get rid of the while rotate do and the wait and the end changing back to custom

Ad

Answer this question