Scene.CreateEntity method
Entity CreateEntity(const std::string& name = "Empty Entity");
Description
Spawns a fresh entity in this scene with three default components:
- IDComponent — random 64-bit UUID for persistence.
- TransformComponent — position (0,0,0), no rotation, scale (1,1,1).
- TagComponent — the
namestring (defaults to "Empty Entity").
Add more components via AddComponent.
Parameters
| name | const std::string& | Display name in the Hierarchy panel. |
Returns
| Entity | handle | Newly-created entity handle (always valid). |
Example
Entity light = scene->CreateEntity("Sun");
auto& dl = light.AddComponent<Thread::DirectionalLightComponent>();
dl.Intensity = 1.5f;
light.GetComponent<Thread::TransformComponent>().Rotation =
Thread::Vec3(Thread::Math::Radians(-45.0f), Thread::Math::Radians(30.0f), 0.0f);
Scene.CreateEntity metoda
Entity CreateEntity(const std::string& name = "Empty Entity");
Opis
Tworzy w tej scenie nową encję z trzema domyślnymi komponentami:
- IDComponent — losowy 64-bitowy UUID do zapisu.
- TransformComponent — pozycja (0,0,0), bez obrotu, skala (1,1,1).
- TagComponent — napis
name(domyślnie „Empty Entity”).
Kolejne komponenty dodasz przez AddComponent.
Parametry
| name | const std::string& | Nazwa wyświetlana w panelu Hierarchy. |
Zwraca
| Entity | uchwyt | Uchwyt nowej encji (zawsze ważny). |
Przykład
Entity light = scene->CreateEntity("Sun");
auto& dl = light.AddComponent<Thread::DirectionalLightComponent>();
dl.Intensity = 1.5f;
light.GetComponent<Thread::TransformComponent>().Rotation =
Thread::Vec3(Thread::Math::Radians(-45.0f), Thread::Math::Radians(30.0f), 0.0f);