TransformComponent struct in Thread
Spatial state of an entity. Attached automatically by
Scene.CreateEntity — never AddComponent
manually. Rotation is stored as Euler angles in radians.
Properties
| Translation | Thread::Vec3 | Local position in metres, relative to parent (or world if root). Default {0, 0, 0}. |
| Rotation | Thread::Vec3 | Euler radians (pitch, yaw, roll). Default {0, 0, 0}. |
| Scale | Thread::Vec3 | Per-axis scale. Default {1, 1, 1}. |
Methods
| GetTransform() | Thread::Mat4 | Local matrix T · R · S. |
| GetWorldTransform(reg, e) | Thread::Mat4 | Walks up the HierarchyComponent chain to produce a world matrix. |
Example
auto& tc = GetComponent<Thread::TransformComponent>();
tc.Translation += Thread::Vec3(0.0f, 0.0f, -1.0f) * ts * 5.0f; // forward 5 m/s
tc.Rotation.y += ts * Thread::Math::Radians(90.0f); // spin 90 deg/s
TransformComponent struct w Thread
Stan przestrzenny encji. Dodawany automatycznie przez
Scene.CreateEntity — nigdy nie dodawaj go ręcznie przez
AddComponent. Rotacja jest przechowywana jako kąty Eulera w radianach.
Właściwości
| Translation | Thread::Vec3 | Lokalna pozycja w metrach, względem rodzica (albo świata, jeśli to korzeń). Domyślnie {0, 0, 0}. |
| Rotation | Thread::Vec3 | Euler w radianach (pitch, yaw, roll). Domyślnie {0, 0, 0}. |
| Scale | Thread::Vec3 | Skala w każdej osi. Domyślnie {1, 1, 1}. |
Metody
| GetTransform() | Thread::Mat4 | Macierz lokalna T · R · S. |
| GetWorldTransform(reg, e) | Thread::Mat4 | Idzie w górę łańcucha HierarchyComponent i składa macierz świata. |
Przykład
auto& tc = GetComponent<Thread::TransformComponent>();
tc.Translation += Thread::Vec3(0.0f, 0.0f, -1.0f) * ts * 5.0f; // naprzód 5 m/s
tc.Rotation.y += ts * Thread::Math::Radians(90.0f); // obrót 90°/s