Created
September 9, 2013 22:32
-
-
Save anonymous/6502395 to your computer and use it in GitHub Desktop.
test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
# Data from Sketchup. | |
cam = lambda: None | |
cam.eye = (240.719, -236.069, 102.276) | |
cam.target = (-285.372, 553.004, -82.0446) | |
cam.fov = 35.0 | |
# Create empty to target. | |
bpy.ops.object.empty_add(location=cam.target) | |
target = bpy.context.object | |
# Create camera. | |
bpy.ops.object.camera_add(location=cam.eye) | |
bpy.context.object.data.lens = cam.fov | |
# Configure camera to track the empty. | |
constraint = bpy.context.object.constraints.new("TRACK_TO") | |
constraint.target = target | |
constraint.track_axis = "TRACK_NEGATIVE_Z" | |
constraint.up_axis = "UP_Y" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment