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")