How do I get the roblox studio's editor camera position?

Hello, I am trying to get the camera’s position and orientation while in editing mode. This would be very helpful when needing to easily determine the good camera view for a cutscene. Something like how Moon Animator does its camera cutscenes.

Any knowledge would be much appreciated! :grin:

1 Like

The camera in roblox works on a coordinate system known as CFrame, you might hear of it before.
Sadly, the roblox camera has no standalone Position value, nor a Orientation value, but instead a CFrame consisting of 2 Vector3s. One Vector3:

Camera.CFrame.Position

Is used to determine its Position and the Second Vector3:

Camera.CFrame.LookVector

Determines where the Camera is looking at.

Now, to get these Values is simple.

Go to The view tab and click on command bar (If you don’t have the command bar open)

and then type into the command bar:

--for Position
print(workspace.CurrentCamera.CFrame.Position)
--for LookVector
print(workspace.CurrentCamera.CFrame.LookVector)

And then press enter and then go to your output, (Go to the view tab and click output if the output window does not show up) and copy the values needed.

I hope you found this reply useful! :happy1:

For more on CFrames: Understanding CFrames

9 Likes

Ah, thank you so much for the detailed explaination.

I saw you working on it for like 20 minutes, but man was it smart of you to use the output :sweat_smile:

ill make sure ill read it thoroughly, thanks again!

1 Like

How would I go about getting the camera position in Studio to change? While your information on how to get the coordinates is helpful, it doesn’t tell me how to get the camera in Studio to change to those coordinates.

Correct me if I’m wrong, I think what you are saying is that, after you run the line of code, the value didn’t change.

The lines of code I wrote out isn’t in a loop, so, it’s like taking a picture, the values stay and won’t change, just like a picture. If you need constantly updating values, you need the code inside the loop

BUT DO NOT ENTER ANY INFINITE LOOP CODE IN THE COMMAND BAR, IT WILL CAUSE PROBLEMS.

So, you can only get values that do not update unless you run the code again.

Those don’t even execute anything, they just print.

2 Likes

That’s the point, you are printing out the values so you could get them, you aren’t running any thing to change the properties.