2023年4月8日土曜日

逆さ円錐 ミンコフスキー型  ファイルからでも再生anime できる

 



import bpy

from mathutils import Vector


# Set target location

target_location = Vector((0, 0, 60))


# Set initial location

initial_location = Vector((0, 0, -30))


# Set cone properties

cone_radius = 60

cone_height = 60


# 初期位置との距離から速度を計算する


chousei_kijyun = 30


distances = [math.sqrt(sum([(a - b) ** 2 for a, b in zip(loc, target_location)])) for loc in initial_locations]


speeds = [0.1 * distance / chousei_kijyun if distance > 0 else 0 for distance in distances]






# Create cone object and set location

bpy.ops.mesh.primitive_cone_add(radius1=0, radius2=cone_radius, depth=cone_height)

cone = bpy.context.object

cone.location = initial_location


# Set animation keyframes

last_frame = 600

for frame in range(last_frame+1):

    distance = (target_location - cone.location).length

    if distance > 0.01:

        direction = (target_location - cone.location).normalized()

        cone.location += direction * min(0.1, distance)

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




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()






改良中 y=-30 中心 円周への球体36個

できた y= -30 中心で z=0平面移動  import bpy import math zion_collection_name = "線路レール 観察者" # コレクションを作成する col = bpy.data.collections.new(zio...