2023年3月19日日曜日

aaa










import bpy
from mathutils import Vector
from math import sqrt

# Create first sphere
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.5, enter_editmode=False, location=(-30, 0, 0))
obj1 = bpy.context.active_object

# Animate first sphere
frames = 40 * bpy.context.scene.render.fps
for i in range(frames):
    if obj1.location[0] < 0:
        obj1.location = ((60 / frames) * i - 30, 0, 0)
    else:
        obj1.location = (30, 0, 0)
    obj1.keyframe_insert(data_path="location", frame=i)

# Create second sphere
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.5, enter_editmode=False, location=(30, 0, 0))
obj2 = bpy.context.active_object

# Animate second sphere
for i in range(frames):
    if obj2.location[0] > 0:
        obj2.location = (30 - (60 / frames) * i, 0, 0)
    else:
        obj2.location = (-30, 0, 0)
    obj2.keyframe_insert(data_path="location", frame=i)

# Create third sphere
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.5, enter_editmode=False, location=(0, 0, -10))
obj3 = bpy.context.active_object

# Animate third sphere
for i in range(frames):
    # Check for collision between obj1 and obj2
    if sqrt(sum((obj1.location - obj2.location)**2)) < obj1.dimensions[0]:
        obj3.location = Vector((0, 0, 10))
    else:
        obj3.location = Vector((0, 0, -10))
    obj3.keyframe_insert(data_path="location", frame=i)





























bbb

連番 007 未来光円錐 過去光円錐 円周中心からの球体放出

aaa 参考 2023年3月26日日曜日 製作 002b 未来光円錐の方向 線路レールで https://ia2023sha.blogspot.com/2023/03/002b.html import bpy import math zion_co...