Created
July 30, 2020 08:03
-
-
Save takawo/aef1b8f22869080f8aebe76a1a5311df to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| import random | |
| cells = 5 | |
| size = 10 | |
| def map(sensor_val, in_from, in_to, out_from, out_to): | |
| out_range = out_to - out_from | |
| in_range = in_to - in_from | |
| in_val = sensor_val - in_from | |
| val=(float(in_val)/in_range)*out_range | |
| out_val = out_from+val | |
| return out_val | |
| for i in range(0,cells): | |
| for j in range(0,cells): | |
| for k in range(0,cells): | |
| x = map(i,0,cells-1,-size,size) | |
| y = map(j,0,cells-1,-size,size) | |
| z = map(k,0,cells-1,-size,size) | |
| rx = random.randint(0,8) * 360/8; | |
| ry = random.randint(0,8) * 360/8; | |
| rz = random.randint(0,8) * 360/8; | |
| bpy.ops.mesh.primitive_cube_add(rotation=(rx,ry,rz),location=(x,y,z)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment