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 | |
from numpy.random import uniform | |
def rand_camera_loc(camera, xloc_range, yloc_range, zloc_range): | |
""" Randomize camera location for each axis based on the provided ranges """ | |
new_loc = camera.location | |
new_loc[0] = uniform(low=xloc_range[0], high=xloc_range[1]) | |
new_loc[1] = uniform(low=yloc_range[0], high=yloc_range[1]) | |
new_loc[2] = uniform(low=zloc_range[0], high=zloc_range[1]) | |
camera.location = new_loc |
OlderNewer