2023年4月6日木曜日

正方形 回転

 



# xy平面 正方形 回転

import bpy

import math


# 20x20の正方形を作成

bpy.ops.mesh.primitive_plane_add(size=20, enter_editmode=False, location=(0, 0, 0))


# 新しいオブジェクトを取得

obj = bpy.context.active_object


# オブジェクトを回転させるアニメーションを作成

num_frames = 60  # アニメーションのフレーム数

rotation_angle = math.radians(360 / num_frames)  # 回転角度

for i in range(num_frames):

    bpy.context.scene.frame_set(i)

    obj.rotation_euler[2] += rotation_angle  # Z軸周りに回転する

    obj.keyframe_insert(data_path="rotation_euler", index=-1)


# アニメーションの開始と終了フレームを設定

bpy.context.scene.frame_start = 0

bpy.context.scene.frame_end = num_frames






# z 軸 正方形 回転



import bpy
import math

# 20x20の正方形を作成
bpy.ops.mesh.primitive_plane_add(size=20, enter_editmode=False, location=(0, 0, 0))

# 新しいオブジェクトを取得
obj = bpy.context.active_object

# オブジェクトをx軸周りに90度回転させる
obj.rotation_euler[0] = math.radians(90)

# 回転速度を設定
zion_round_speed = 0.2

# オブジェクトを回転させるアニメーションを作成
num_frames = 60  # アニメーションのフレーム数
rotation_angle = math.radians(360 * zion_round_speed / num_frames)  # 回転角度
for i in range(num_frames):
    bpy.context.scene.frame_set(i)
    obj.rotation_euler[2] += rotation_angle  # Z軸周りに回転する
    obj.keyframe_insert(data_path="rotation_euler", index=-1)

# アニメーションの開始と終了フレームを設定
bpy.context.scene.frame_start = 0
bpy.context.scene.frame_end = num_frames








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

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