# Camera Rotation in World Coordinates?

Are the coordinates of the camera in the world coordinate system? If they are not, how can I change to the world coordinate?

• Camera rotation in world coordinate?
– 于薏萱
Commented Mar 20, 2019 at 7:14

The transform properties display LOCAL coordinates.

The values for location, rotation and scale are local coordinates.

They will also be the global coordinates if camera has no parent, or all its ancestors have Identity matrix world (0 loc and rot unit scale) (and there are no constraints involved)

To display the global location of an object snap the 3d cursor to the object. (ShiftS Cursor to active) The 3d cursor is always in global coordinates.

In cases where you can set the global location of camera, move the 3d cursor and (ShiftS Active to Cursor) Note if there are constraints (for example copy location) then these will override any transform property settings.

Can get the global rotation from the console with

>>> C.object.matrix_world.to_euler()
Euler((0.7297371029853821, -0.4792802035808563, -0.5616455078125), 'XYZ')


>>> [degrees(a) for a in C.object.matrix_world.to_euler()]
[41.8108561551659, -27.460732869353954, -32.179917180138155]


Displaying in the UI.

Cube rotated locally in y 45 degrees. Parented to empty. The global rotation is displayed below the local. (The Cube is pinned to properties, as the empty parent is rotated)

Bare bones example script for 2.8 to put global rotation euler 'XYZ' on transform panel. Didn't add a setter, hence the disabled look.

import bpy
from mathutils import Vector
from bpy.props import PointerProperty, FloatVectorProperty, IntProperty
def global_rotation_euler(self):
ob = self.id_data
return ob.matrix_world.to_euler() # ob.rotation_type

from bpy.types import PropertyGroup
class GlobalCoords(PropertyGroup):
x : IntProperty()
rotation_euler : FloatVectorProperty(name="Rotation",
default=(0, 0, 0),
size=3,
subtype='EULER',
precision=3,
get=global_rotation_euler)

bpy.utils.register_class(GlobalCoords)

bpy.types.Object.global_coords = PointerProperty(type=GlobalCoords)

def draw_global_coords(self, context):
ob = context.object
layout = self.layout
col = layout.column()
col.prop(ob.global_coords, "rotation_euler")

bpy.types.OBJECT_PT_transform.append(draw_global_coords)

• But the 3D cursor only have the location. It does'n show the rotation.
– 于薏萱
Commented Mar 21, 2019 at 2:03
• As clearly stated in the answer. The cursor does have rotation in 2.8. Unfortunately for the time being snap only snaps to location not rotation. Commented Mar 21, 2019 at 4:16
• So if there is no father and we chose Gloal for Transformation orientation, the rotation in the blender operation interface represent the global rotation?
– 于薏萱
Commented Mar 21, 2019 at 5:36
• The transform properties displays a decomposed local matrix into translation, rotation (of chosen type), and scale. Changing the transformation orientation does not change this. Commented Mar 21, 2019 at 8:53

These?

You can use Camera as Object in Object Mode. This menu can be used after N keypress.

• These are the local coordinates. Commented Mar 20, 2019 at 15:03
• You mean if there is no father and we chose Gloal for Transformation orientation, the above represent the global location and rotation?
– 于薏萱
Commented Mar 21, 2019 at 2:02
• I can use C.scene.cursor_location to get the location, but I don't know where I can user cursor_orientation or where I can find the orientation in blender operation interface.
– 于薏萱
Commented Mar 21, 2019 at 2:26