🧠
OpenAI
Udemy курс UE/C++PatreonBoostyTelegramYoutube
  • 🧠OpenAI
    • Unreal Engine plugin
    • Functions
    • Chat-GPT4 vs. Unreal Engine 5
    • DALLE 3 | Text To Speech | Vision
    • Vision + Text To Speech демо в CitySample
    • Model context protocol
      • Python scripts
    • 00. OpenAI Museum. Promo
    • 01. OpeanAI Museum. Core
    • 02. OpenAI Museum. UI
    • 03. OpenAI Museum. UI. MVVM C++
    • 04. OpenAI Museum. DALLE-3
  • 📚Мои курсы
    • 🎮Unreal Engine — полное руководство по разработке на С++
    • 🧪Автоматизация и тестирование в Unreal Engine
    • 🐍Snake game
    • 🔊Meta sounds
    • 🕹️Game Engine hardCORE series
    • 🏗️Design patterns
  • 🔗LifeEXE сообщество
    • Ресурсы
    • Поддержать проект
    • Проекты участников сообщества
    • Code review участников сообщества
Powered by GitBook
On this page
  1. OpenAI
  2. Model context protocol

Python scripts

import unreal

print(f'UE version {unreal.SystemLibrary.get_engine_version()}')
import unreal

editor_actor_subsystem = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
all_actors = editor_actor_subsystem.get_all_level_actors()

print(f"Found {len(all_actors)} actors in the scene:")

for actor in all_actors:
    if actor:
        print(f"- {actor.get_name()} ({actor.get_class().get_name()})")
    else:
        print(f"- [Invalid actor]")
        
import unreal
import random

x = random.uniform(-500.0, 500.0)
y = random.uniform(-500.0, 500.0)
z = random.uniform(0.0, 500.0)
sphere_location = unreal.Vector(x, y, z)

actor_class = unreal.StaticMeshActor

spawned_actor = unreal.EditorLevelLibrary.spawn_actor_from_class(
    actor_class, sphere_location, unreal.Rotator(0.0, 0.0, 0.0)
)

if spawned_actor:
    sphere_mesh = unreal.load_asset('/Engine/BasicShapes/Sphere.Sphere')
    if sphere_mesh:
        static_mesh_component = spawned_actor.get_component_by_class(unreal.StaticMeshComponent)
        if static_mesh_component:
            static_mesh_component.set_static_mesh(sphere_mesh)
            print(f'Sphere spawned at {sphere_location}')
        else:
            print('Error: Could not find StaticMeshComponent on spawned actor.')
    else:
        print('Error: Could not load /Engine/BasicShapes/Sphere.Sphere')
else:
    print('Error: Failed to spawn StaticMeshActor.')
PreviousModel context protocolNext00. OpenAI Museum. Promo

Last updated 1 month ago

🧠