そろそろ立体にしてみようかと思っているところです。
#blender 3.0.0
import bpy
import random
for item in bpy.data.meshes:
bpy.data.meshes.remove(item)
domino_distance = 10
domino_count = 50
domino_width = 4
mat_b = bpy.data.materials.new("Blue")
mat_b.diffuse_color = (0, 0, 1, 1.0)
mat_w = bpy.data.materials.new("White")
mat_w.diffuse_color = (1, 1, 1, 1.0)
for x in range(1,domino_count):
for y in range(x):
x_location = (x - 1)*domino_distance + random.random()
y_location = (y-x/2)*domino_width *3
bpy.ops.mesh.primitive_cube_add(location=(x_location, y_location, 0), scale=(1,domino_width,10),rotation=(0, 0, 0.0) )
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.friction = 1
if random.random() > 0.6:
bpy.context.object.data.materials.append(mat_w)
else:
bpy.context.object.data.materials.append(mat_b)
if x== 1:
bpy.context.object.rotation_euler[1] = 0.3
s=domino_distance * domino_count*1.2
bpy.ops.mesh.primitive_plane_add(size=s, location=(s/2 - 10, 0, -10 ), scale=(1, 1, 1))
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'PASSIVE'
0 件のコメント:
コメントを投稿