From f4078a819b05eb36220f7bf5655c936ef1b34375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Fonseca?= Date: Thu, 1 Feb 2024 12:25:54 +0000 Subject: [PATCH] feat(transform): add missing LocalToParent relations --- engine/include/cubos/engine/transform/plugin.hpp | 4 ++-- engine/src/cubos/engine/transform/plugin.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/engine/include/cubos/engine/transform/plugin.hpp b/engine/include/cubos/engine/transform/plugin.hpp index ab0778472a..a3bee01b6b 100644 --- a/engine/include/cubos/engine/transform/plugin.hpp +++ b/engine/include/cubos/engine/transform/plugin.hpp @@ -42,8 +42,8 @@ namespace cubos::engine /// ## Tags /// - `cubos.transform.missing.local_to_world` - the @ref LocalToWorld components are added to entities with @ref /// Position, @ref Rotation or @ref Scale components. - /// - `cubos.transform.missing` - the @ref Position, @ref Rotation and @ref Scale components are added to entities - /// with @ref LocalToWorld components. + /// - `cubos.transform.missing` - the @ref Position, @ref Rotation, @ref Scale and possibly @ref LocalToParent + /// components are added to entities with @ref LocalToWorld components. /// - `cubos.transform.update` - the @ref LocalToWorld components are updated with the information from the @ref /// Position, @ref Rotation and @ref Scale components. diff --git a/engine/src/cubos/engine/transform/plugin.cpp b/engine/src/cubos/engine/transform/plugin.cpp index 51174d1a84..800d4b652e 100644 --- a/engine/src/cubos/engine/transform/plugin.cpp +++ b/engine/src/cubos/engine/transform/plugin.cpp @@ -77,6 +77,20 @@ void cubos::engine::transformPlugin(Cubos& cubos) } }); + cubos.system("add LocalToParent to entities with LocalToWord and ChildOf other entity with LocalToWorld") + .tagged("cubos.transform.missing") + .entity() + .without() + .with() + .related() + .with() + .call([](Commands cmds, Query query) { + for (auto [e] : query) + { + cmds.add(e, LocalToParent{}); + } + }); + cubos.tag("cubos.transform.missing").before("cubos.transform.update"); cubos.system("update LocalToWorld")