import bpy
import mathutils
import math
import random
# 2個の球体を作成
num_spheres = 2
radius = 1.0
min_distance = 2 * radius
# すでに配置された球体の位置を格納するリストを作成
positions = []
for i in range(num_spheres):
# ランダムな位置を計算
while True:
x = random.uniform(-5.0, 5.0)
y = random.uniform(-5.0, 5.0)
z = random.uniform(-5.0, 5.0)
pos = mathutils.Vector((x, y, z))
# 他の球体との距離が一定の距離以上ある場合にのみ配置
if all((pos - p).length > min_distance for p in positions):
positions.append(pos)
break
# 距離が短い場合は、再度ランダムな位置を計算する
bpy.ops.mesh.primitive_uv_sphere_add(location=pos, radius=radius)
# 全てのオブジェクトを選択
bpy.ops.object.select_all(action='SELECT')
# 平面に配置
bpy.ops.object.align(align_mode='OPT_1', relative_to='OPT_2', align_axis=(False, False, True),
align_axis_orientation='GLOBAL', distribution='EVEN')
# 3Dビューポートを更新
bpy.context.view_layer.update()
あああああああああああああああああああああ
import bpy
import mathutils
import math
# Number of spheres
num_spheres = 5
# Radius of spheres
sphere_radius = 1.0
# Distance between spheres
sphere_distance = 2.0
# Calculate angle between spheres
angle = (2*math.pi)/num_spheres
# Loop through spheres and position them
for i in range(num_spheres):
x = math.cos(i*angle)*sphere_distance
y = math.sin(i*angle)*sphere_distance
z = 0
bpy.ops.mesh.primitive_uv_sphere_add(radius=sphere_radius, location=(x, y, z))
import bpy
import math
import mathutils
# Number of spheres
num_spheres = 5
# Radius of spheres
sphere_radius = 1.0
# Distance between spheres
sphere_distance = 2.0
# Calculate angle between spheres
angle = (2*math.pi)/num_spheres
# Loop through spheres and position them
for i in range(num_spheres):
x = math.cos(i*angle)*sphere_distance
y = math.sin(i*angle)*sphere_distance
z = 0
bpy.ops.mesh.primitive_uv_sphere_add(radius=sphere_radius, location=(x, y, z))
togetter.com/t/c2022meetzionad
togetter.com/t/b2022meetzionad
twitter 新着検索 Dürer & 測距儀
aaa
bbb
ccc twitter zionadchat
twitter に追い出されたら 連絡先は Gettr https://gettr.com/user/zionadchat
twitter サブアカウント https://twitter.com/2022zionad
old page いいい
new page いいい
目次 2022の目次 単純トリック hatena zionadchat
いいいいいいいい