Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I find the STUDIO camera position?

Hello. I was wondering how I could find the camera x,y,z, as well as rotation in studio. Where do I find it? I want the STUDIO camera, not the roblox camera when you join the game. I'd like to use this for camera manipulation. Thanks!

1 comment

0

Pretty sure you can just change the camera CFrame using a script that is a plugin or in the command line/input window.

2 answers

✓ Accepted answer

try

local Camera = workspace.CurrentCamera -- works for studio camera as well!
local X, Y, Z = 0,0,0
local Roll,Yaw,Pitch = 0,0,0

local function getOrientation(CF)
	local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = CF:components()
	local Yaw = math.atan2(m02, m22)*(180/math.pi)+180
	local Pitch = math.asin(-m12)*(180/math.pi)+180
	local Roll = math.atan2(m10, m11)*(180/math.pi)+180
	return Pitch,Roll,Yaw
end


while true do
	Pitch,Roll,Yaw = getOrientation(Camera.CFrame)
	X = Camera.CFrame.Position.X
	Y = Camera.CFrame.Position.Y
	Z = Camera.CFrame.Position.Z
	print("[",X,Y,Z,"][",Pitch,Roll,Yaw,"]")
	wait()
end

You may need to play around with the code a little to get the Camera rotation to display correctly.

The getOrientation() function was taken from the old CFrame wiki before they updated the wiki so it may not work correctly now. But it should get you started on how to deal with the camera rotation!.

NOTE:

The above code should be run in a normal Server Script and NOT a Local Script. Think if it was run in a Local script it would be using the player camera rather than the studio/server camera!.

hope this helps! :)

1 comment

0

Are the Yaw pitch and roll in the correct order?

In order to achieve this:

Open up command bar in view and type in

print(workspace.CurrentCamera.CFrame.Position)

It should successfully get your position of the camera.

3 comments

0

Works, but I also need the position

0

what does that even mean I gave you the position, if you want it with the orientation use just CFrame

0

Sorry, I meant the rotation

This discussion is preserved as it was. New answers, comments, and votes are closed.