0
$\begingroup$

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

$\endgroup$
  • $\begingroup$ Camera rotation in world coordinate? $\endgroup$ – 于薏萱 Mar 20 '19 at 7:14
2
$\begingroup$

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')

that's in radians. In degrees

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

Displaying in the UI.

enter image description here 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) 
$\endgroup$
  • $\begingroup$ But the 3D cursor only have the location. It does'n show the rotation. $\endgroup$ – 于薏萱 Mar 21 '19 at 2:03
  • $\begingroup$ 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. $\endgroup$ – batFINGER Mar 21 '19 at 4:16
  • $\begingroup$ So if there is no father and we chose Gloal for Transformation orientation, the rotation in the blender operation interface represent the global rotation? $\endgroup$ – 于薏萱 Mar 21 '19 at 5:36
  • $\begingroup$ The transform properties displays a decomposed local matrix into translation, rotation (of chosen type), and scale. Changing the transformation orientation does not change this. $\endgroup$ – batFINGER Mar 21 '19 at 8:53
0
$\begingroup$

These?

enter image description here

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

$\endgroup$
  • 1
    $\begingroup$ These are the local coordinates. $\endgroup$ – batFINGER Mar 20 '19 at 15:03
  • $\begingroup$ You mean if there is no father and we chose Gloal for Transformation orientation, the above represent the global location and rotation? $\endgroup$ – 于薏萱 Mar 21 '19 at 2:02
  • $\begingroup$ 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. $\endgroup$ – 于薏萱 Mar 21 '19 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.