2023年4月3日月曜日

 




    


半径1の球体B を作成する


t=0に

xyz -50、50,0 移動開始


t=10に

xyz 0,ー30,0  移動終了


t=0に

xyz 50、50,0 移動開始

t=0に

xyz 0,ー30,0  移動終了



(-50,50,0)と (0,-30,0) の距離を distance_1 計算する

(-50,50,0)と (50,50,0)  の距離を distance_0 計算する


半径1の球体Bの進む速度は

distance_0 / distance_1  に 設定する





カメラを

0,50,0

0,0,0

0,50、0 に設定する




球体が 動かないので 半径1の 球体の放出を t=0 と t=10にする 半径2の球体は t=0から t=10 で 指定の移動をする





失敗続き なので


カメラが動く これだけ 採用




import bpy


# create sphere B

bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(0, 0, 0), segments=32, ring_count=16)


# select sphere B and set initial location

bpy.ops.object.select_all(action='DESELECT')

sphere = bpy.data.objects['Sphere']

sphere.select_set(True)

sphere.location = (0, 0, 0)

sphere.keyframe_insert(data_path='location', frame=0)


# set location at t=0 to (-50, 50, 0) and insert keyframe

sphere.location = (-50, 50, 0)

sphere.keyframe_insert(data_path='location', frame=10)


# set location at t=10 to (0, -30, 0) and insert keyframe

sphere.location = (0, -30, 0)

sphere.keyframe_insert(data_path='location', frame=20)


# deselect sphere B

sphere.select_set(False)








下記は修正されたスクリプトです。半径1の球体は、初期位置から目標位置までの距離をもとに、放出時の速度を計算しています。







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

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