2023年4月8日土曜日

逆さ円錐できた

 import bpy


from mathutils import Vector


# 設定可能な変数


zion_object_name = "逆さ円錐 600上昇"  # 円錐オブジェクトの名前


radius = 60  # 円錐の半径


height = 60  # 円錐の高さ


distance_per_frame = 0.1  # 円錐の移動距離


animation_frames = 1000  # アニメーションの再生時間(フレーム数)


wait_frames = 40  # アニメーション再生完了後の待機時間(フレーム数)


start_z = -30  # 円錐の初期位置(Z座標)


# 円錐を作成する


def create_cone():


    bpy.ops.mesh.primitive_cone_add(radius1=0, radius2=radius, depth=height)


    cone = bpy.context.object


    cone.name = zion_object_name


    cone.location = Vector((0, 0, start_z))  # 初期位置を設定する


    return cone


cone = create_cone()


# アニメーションのキーフレームを設定する


for i in range(animation_frames):


    frame = i + 1


    # キーフレームごとの円錐の位置を設定する


    zion_pos = Vector((0, 0, cone.location.z + distance_per_frame))


    cone.location = zion_pos


    # キーフレームを設定する


    cone.keyframe_insert(data_path="location", frame=frame)


# アニメーション再生後の待機時間を設定する


for i in range(wait_frames):


    frame = animation_frames + i + 1


    cone.keyframe_insert(data_path="location", frame=frame, index=-1)


半径 √2の トーラス

  import bpy import math # 半径√2 major_radius = math.sqrt(2) # マイナー半径0.2 minor_radius = 0.05 # トーラスを作成 bpy.ops.mesh.primitive_torus_add(major...