2023年4月6日木曜日

完成 球体 軸線 移動

 


import bpy

zion_collection_name = "軸線 球体"


# コレクションを作成する

col = bpy.data.collections.new(zion_collection_name)

bpy.context.scene.collection.children.link(col)






import bpy

from mathutils import Vector


# 目標位置を指定する

target_location = Vector((30, 30, 30))


# フレーム数を指定する

last_frame = 600


# 移動する距離を指定する

distance_per_frame = 0.1


# 球体を作成する

location = Vector((0, 0, 0))

radius = 1

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

sphere = bpy.context.active_object

sphere.name = "√3 MovingSphere"


# アニメーションを設定する

start_location = sphere.location

direction = (target_location - start_location).normalized()

for frame in range(1, last_frame + 1):

    sphere.location += distance_per_frame * direction

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





import bpy

from mathutils import Vector


# 目標位置を指定する

target_location = Vector((30, 30, 0))


# フレーム数を指定する

last_frame = 600


# 移動する距離を指定する

distance_per_frame = 0.1


# 球体を作成する

location = Vector((0, 0, 0))

radius = 1

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

sphere = bpy.context.active_object

sphere.name = "√2 MovingSphere"


# アニメーションを設定する

start_location = sphere.location

direction = (target_location - start_location).normalized()

for frame in range(1, last_frame + 1):

    sphere.location += distance_per_frame * direction

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





import bpy

from mathutils import Vector


# 目標位置を指定する

target_location = Vector((30, 0, 0))


# フレーム数を指定する

last_frame = 600


# 移動する距離を指定する

distance_per_frame = 0.1


# 球体を作成する

location = Vector((0, 0, 0))

radius = 1

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

sphere = bpy.context.active_object

sphere.name = "1 MovingSphere"


# アニメーションを設定する

start_location = sphere.location

direction = (target_location - start_location).normalized()

for frame in range(1, last_frame + 1):

    sphere.location += distance_per_frame * direction

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



# 半径30の円板 土台



import bpy

import bmesh

import math


radius = 30


bm = bmesh.new()


segments = 32


for i in range(segments):

    x = radius * math.cos(2 * math.pi * i / segments)

    y = radius * math.sin(2 * math.pi * i / segments)

    bm.verts.new((x, y, 0))


face = bm.faces.new(bm.verts)


mesh = bpy.data.meshes.new('CircleMesh')

bm.to_mesh(mesh)

bm.free()


obj = bpy.data.objects.new('Circle', mesh)

bpy.context.scene.collection.objects.link(obj)




# 半径30の円板 土台 y=-30


import bpy

import bmesh

import math


radius = 30


bm = bmesh.new()


segments = 32


for i in range(segments):

    x = radius * math.cos(2 * math.pi * i / segments)

    y = radius * math.sin(2 * math.pi * i / segments) - 15 # Subtract 30 from y coordinate

    bm.verts.new((x, y, 0))


face = bm.faces.new(bm.verts)


mesh = bpy.data.meshes.new('CircleMesh')

bm.to_mesh(mesh)

bm.free()


obj = bpy.data.objects.new('Y=-15 Circle', mesh) # Rename object

obj.location = (0, -15, 0) # Set object location

bpy.context.scene.collection.objects.link(obj)


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

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