Skip to content

Commit

Permalink
feat(transform): add missing LocalToParent relations
Browse files Browse the repository at this point in the history
  • Loading branch information
luishfonseca committed Feb 1, 2024
1 parent 62c3cf4 commit f4078a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engine/include/cubos/engine/transform/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
14 changes: 14 additions & 0 deletions engine/src/cubos/engine/transform/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LocalToParent>()
.with<LocalToWorld>()
.related<ChildOf>()
.with<LocalToWorld>()
.call([](Commands cmds, Query<Entity> query) {
for (auto [e] : query)
{
cmds.add(e, LocalToParent{});
}
});

cubos.tag("cubos.transform.missing").before("cubos.transform.update");

cubos.system("update LocalToWorld")
Expand Down

0 comments on commit f4078a8

Please sign in to comment.