3
$\begingroup$

How can I easily find out the current X,Y,Z position of the viewport camera, and/or edit them numerically? Not necessarily a camera object, just the point I'm currently viewing the scene from.

It would be useful if I want to check I'm viewing it from human head height, for example.

$\endgroup$
1
  • 1
    $\begingroup$ There is also the add-on "Stored View" that ships with Blender. It lets you create a camera from the current view. Then you can see there the transformation settings. $\endgroup$
    – Blunder
    Commented Aug 26, 2023 at 11:11

1 Answer 1

3
$\begingroup$

Try the following script. When you execute it in the Text Editor, it will set the 3D Cursor at the center of the position of your current view in the 3D Viewport. Notice that after I execute the script, I slightly zoom out so you can see the position of the 3D Cursor where previously the view of 3D Viewport was located at.

enter image description here

import bpy

area = next(area for area in bpy.context.window.screen.areas if area.type == 'VIEW_3D')
current_location = area.spaces.active.region_3d.view_matrix.inverted().translation
print("Location of Current View:", current_location)
bpy.context.scene.cursor.location = current_location
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .