Skip to main content
Blender 2.8x
Source Link
p2or
  • 16.1k
  • 10
  • 87
  • 146

2.8x

import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world.to_quaternion() @ Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world.to_quaternion() @ Vector((0.0, 0.0, -1.0))

2.7x

import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world.to_quaternion() * Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world.to_quaternion() * Vector((0.0, 0.0, -1.0))

cam coordinates

import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world.to_quaternion() * Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world.to_quaternion() * Vector((0.0, 0.0, -1.0))

cam coordinates

2.8x

import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world.to_quaternion() @ Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world.to_quaternion() @ Vector((0.0, 0.0, -1.0))

2.7x

import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world.to_quaternion() * Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world.to_quaternion() * Vector((0.0, 0.0, -1.0))

cam coordinates

added 18 characters in body
Source Link
pink vertex
  • 9.9k
  • 1
  • 26
  • 45
import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world.to_quaternion() * Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world.to_quaternion() * Vector((0.0, 0.0, -1.0))

cam coordinates

import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world * Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world * Vector((0.0, 0.0, -1.0))

cam coordinates

import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world.to_quaternion() * Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world.to_quaternion() * Vector((0.0, 0.0, -1.0))

cam coordinates

Source Link
pink vertex
  • 9.9k
  • 1
  • 26
  • 45

import bpy
from mathutils import Vector

cam = bpy.data.objects['Camera']
up = cam.matrix_world * Vector((0.0, 1.0, 0.0))
cam_direction = cam.matrix_world * Vector((0.0, 0.0, -1.0))

cam coordinates