投稿

球体 36個 円周 順番 発射 

イメージ
  # コレクションを作成 import bpy collection_name = "球体 順番発射" if collection_name not in bpy.data.collections:     zionad_collection = bpy.data.collections.new(collection_name)     bpy.context.scene.collection.children.link(zionad_collection) else:     zionad_collection = bpy.data.collections[collection_name] import bpy import math import mathutils # 移動速度の調整 zion_speed = 0.2 # パラメーター radius = 2 num_spheres = 36 sphere_radius = 0.1 z = -2 # 円周上に球体を配置 for i in range(num_spheres):     angle = 2 * math.pi * i / num_spheres     x = radius * math.cos(angle)     y = radius * math.sin(angle)          # 球体を作成     bpy.ops.mesh.primitive_uv_sphere_add(radius=sphere_radius, enter_editmode=False, location=(x, y, z))          # オブジェクトを取得     obj = bpy.context.object      # オブジェクト名      bpy.context.object.name = "zion_ball"     # アニメーションを作成     obj.location = (x, y, z)     obj.keyframe_insert(data_path="location", frame=i * 3 / zion_speed + 1)     obj.location = (0, 0, 0)     obj.

# トーラス 完全版 過去光円錐

イメージ
  # トーラス 完全版 過去光円錐 import bpy import math # Adjust movement speed torus_speed = 0.01 # Parameters radius = 1 # Create a torus bpy.ops.mesh.primitive_torus_add(align='WORLD', location=(0, 0, -2), rotation=(0, 0, 0), major_radius=radius, minor_radius=0.05) torus = bpy.context.active_object # Set the animation for the torus for i in range(601):     # Set the current frame     bpy.context.scene.frame_set(i)     # Move the torus     loc = (0, 0, -2 + i * torus_speed)     torus.location = loc     # Resize the torus     radius = abs(loc[2])     torus.scale = (radius, radius, radius)     # Add a keyframe     torus.keyframe_insert(data_path="location")     torus.keyframe_insert(data_path="scale")

円柱を斜めにできないので 11個の球体で 斜線を描く

イメージ
  collection_name = "斜めストロボ 2,0,-2" # コレクションを作成 import bpy collection_name = "斜めストロボ 2,0,-2" if collection_name not in bpy.data.collections:     zionad_collection = bpy.data.collections.new(collection_name)     bpy.context.scene.collection.children.link(zionad_collection) else:     zionad_collection = bpy.data.collections[collection_name] import bpy import math import mathutils zion_number = 11 zion_radius = 0.1 zion_sx = 2 zion_sy = 0 zion_sz = -2 zion_ex = 0 zion_ey = 0 zion_ez = 0 # オブジェクト名を指定 obj_prefix = "sphere" # 半径を指定 radius = zion_radius # 2つの座標を指定 p1 = mathutils.Vector((zion_sx, zion_sy, zion_sz )) p2 = mathutils.Vector ((zion_ex, zion_ey, zion_ez )) # 2点間の距離を計算 distance = (p2 - p1).length # 球体の個数を指定 num_spheres =  zion_number # 等間隔の距離を計算 spacing = distance / (num_spheres - 1) # 球体を生成 for i in range(num_spheres):     # 座標を計算     position = (p2 - p1).normalized() * spacing * i + p1          # 球体を作成     obj_name = obj_prefix + str(i)     bpy.ops.me

正六角形を 正三角形6つで 表示

イメージ
  render # コレクションを作成 import bpy collection_name = "triangle 正六角形" if collection_name not in bpy.data.collections:     zionad_collection = bpy.data.collections.new(collection_name)     bpy.context.scene.collection.children.link(zionad_collection) else:     zionad_collection = bpy.data.collections[collection_name] # コレクションを作成 import bpy collection_name = "過去 円柱円板 円錐" if collection_name not in bpy.data.collections:     zionad_collection = bpy.data.collections.new(collection_name)     bpy.context.scene.collection.children.link(zionad_collection) else:     zionad_collection = bpy.data.collections[collection_name] triangle 作ると  オブジェクト名が すべて 変更されてる import bpy import math import mathutils # 三角形の1辺の長さを指定する triangle_size = 2.0 kakodoai = triangle_size # 正六角形の中心位置を指定する hexagon_center = mathutils.Vector((0.0, 0.0, 0.0)) # 6つの正三角形を作成する for i in range(6):     # 三角形の頂点を計算する     vertex1 = mathutils.Vector((math.cos(i * math.pi / 3), math.sin(i * math.pi / 3), 0.0))     vertex2 = ma

# コレクションを作成

イメージ
  # コレクションを作成 import bpy collection_name = "torus y軸 3つ" if collection_name not in bpy.data.collections:     zionad_collection = bpy.data.collections.new(collection_name)     bpy.context.scene.collection.children.link(zionad_collection) else:     zionad_collection = bpy.data.collections[collection_name] import bpy collection_name = "torus y軸 3つ" if collection_name not in bpy.data.collections:     zionad_collection = bpy.data.collections.new(collection_name)     bpy.context.scene.collection.children.link(zionad_collection) else:     zionad_collection = bpy.data.collections[collection_name]

# フレーム数を変更するための関数

イメージ
  import bpy # フレーム数を変更するための関数 def set_frame_range(start_frame, end_frame):     bpy.context.scene.frame_start = start_frame     bpy.context.scene.frame_end = end_frame # メイン関数 def main():     # フレームレンジを設定する     set_frame_range(1, 640) # スクリプトを実行する if __name__ == "__main__":     main()   import bpy # フレーム数を変更するための関数 def set_frame_range(start_frame, end_frame):     bpy.context.scene.frame_start = start_frame     bpy.context.scene.frame_end = end_frame # メイン関数 def main():     # フレームレンジを設定する     set_frame_range(1, 640) # スクリプトを実行する if __name__ == "__main__":     main()