2023年4月10日月曜日

ファイルから アニメ 再生 可能になったみたい その原型

 


import bpy

import math

from mathutils import Vector


# Set target location

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


# Set initial location and radius

initial_location = Vector((0, 0, 0))

sphere_radius = 2


# Create sphere object

bpy.ops.mesh.primitive_uv_sphere_add(radius=sphere_radius, location=initial_location)

sphere = bpy.context.object


# Set animation keyframes

start_frame = 1

end_frame = 600

for frame in range(start_frame, end_frame+1):

    # Calculate angle based on current frame

    angle = (frame - start_frame) * 2 * math.pi / 200


    # Calculate new sphere location

    x = target_location.x + sphere_radius * math.cos(angle)

    y = target_location.y + sphere_radius * math.sin(angle)

    z = target_location.z

    sphere.location = Vector((x, y, z))


    # Set rotation

    sphere.rotation_euler[2] = angle


    # Insert keyframe

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

    sphere.keyframe_insert(data_path="rotation_euler", frame=frame)


# Set the number of frames

bpy.context.scene.frame_start = start_frame

bpy.context.scene.frame_end = end_frame


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

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