-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Child's Transform component ignored when parent does not have the GlobalTransform/Transform components #2277
Comments
@alice-i-cecile I think this issue is more about bevy's transform and its associated systems. Perhaps |
Yeah; this is... kind of at the intersection of a number of concerns, due to how heavily Transforms are used. @NathanSWard what would you classify this as under the proposed new labelling scheme? |
I wouldn't say it doesn't really fit nicely into a single category, so does it deserve it's own? I mean it already has it's own crate? C: Transform |
Yeah, I think that if we were to use content labels based on crates it would work well. |
As of 0.5 release, my observation is that the children collapse at origin not if the parent is missing |
So is this just missing documentation?
This seems like a misunderstanding. Even "empty" objects in other game engines and tools like Blender have transforms. If the |
I agree, IMO this is primarily a docs issue. |
There was a suggestion to parameterize |
In Unity, yes. A design decision they came to regret since then, having people make hierarchies of objects just for grouping / scene organization in editor, and ruining performance at runtime as Unity needs to update all of those transforms for nothing. UE4 avoids that with
In this context the expectation of @allsey87 seems perfectly legitimate to me. There is nothing in the docs indicating that |
Hmm, I see your point. Bevy does have change detection helping, but definitely want to avoid pointless work.
So does Unreal behave like the reporter expected? Where if an actor's parent in the scene hierarchy has no
All valid points. I assumed from the fact that these components are defined in
I think enforcing that |
IMO Bevy could really do with an optional system for debugging stuff like non-constant hierarchies. For example by printing messages when it detects
I don't think it's exclusively a doc issue, as it's fairly easy to end up in such a situation accidentally, and no amount of docs can completely prevent programming errors. User-defined hierarchies would be what fixes this, and I don't think we have a short term plan for this (it would be covered by relations, but that's a fairly long term plan) |
# Objective A common pitfall since 0.8 is the requirement on `ComputedVisibility` being present on all ancestors of an entity that itself has `ComputedVisibility`, without which, the entity becomes invisible. I myself hit the issue and got very confused, and saw a few people hit it as well, so it makes sense to provide a hint of what to do when such a situation is encountered. - Fixes #5849 - Closes #5616 - Closes #2277 - Closes #5081 ## Solution We now check that all entities with both a `Parent` and a `ComputedVisibility` component have parents that themselves have a `ComputedVisibility` component. Note that the warning is only printed once. We also add a similar warning to `GlobalTransform`. This only emits a warning. Because sometimes it could be an intended behavior. Alternatives: - Do nothing and keep repeating to newcomers how to avoid recurring pitfalls - Make the transform and visibility propagation tolerant to missing components (#5616) - Probably archetype invariants, though the current draft would not allow detecting that kind of errors --- ## Changelog - Add a warning when encountering dubious component hierarchy structure Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
# Objective A common pitfall since 0.8 is the requirement on `ComputedVisibility` being present on all ancestors of an entity that itself has `ComputedVisibility`, without which, the entity becomes invisible. I myself hit the issue and got very confused, and saw a few people hit it as well, so it makes sense to provide a hint of what to do when such a situation is encountered. - Fixes bevyengine#5849 - Closes bevyengine#5616 - Closes bevyengine#2277 - Closes bevyengine#5081 ## Solution We now check that all entities with both a `Parent` and a `ComputedVisibility` component have parents that themselves have a `ComputedVisibility` component. Note that the warning is only printed once. We also add a similar warning to `GlobalTransform`. This only emits a warning. Because sometimes it could be an intended behavior. Alternatives: - Do nothing and keep repeating to newcomers how to avoid recurring pitfalls - Make the transform and visibility propagation tolerant to missing components (bevyengine#5616) - Probably archetype invariants, though the current draft would not allow detecting that kind of errors --- ## Changelog - Add a warning when encountering dubious component hierarchy structure Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
# Objective A common pitfall since 0.8 is the requirement on `ComputedVisibility` being present on all ancestors of an entity that itself has `ComputedVisibility`, without which, the entity becomes invisible. I myself hit the issue and got very confused, and saw a few people hit it as well, so it makes sense to provide a hint of what to do when such a situation is encountered. - Fixes bevyengine#5849 - Closes bevyengine#5616 - Closes bevyengine#2277 - Closes bevyengine#5081 ## Solution We now check that all entities with both a `Parent` and a `ComputedVisibility` component have parents that themselves have a `ComputedVisibility` component. Note that the warning is only printed once. We also add a similar warning to `GlobalTransform`. This only emits a warning. Because sometimes it could be an intended behavior. Alternatives: - Do nothing and keep repeating to newcomers how to avoid recurring pitfalls - Make the transform and visibility propagation tolerant to missing components (bevyengine#5616) - Probably archetype invariants, though the current draft would not allow detecting that kind of errors --- ## Changelog - Add a warning when encountering dubious component hierarchy structure Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
# Objective A common pitfall since 0.8 is the requirement on `ComputedVisibility` being present on all ancestors of an entity that itself has `ComputedVisibility`, without which, the entity becomes invisible. I myself hit the issue and got very confused, and saw a few people hit it as well, so it makes sense to provide a hint of what to do when such a situation is encountered. - Fixes bevyengine#5849 - Closes bevyengine#5616 - Closes bevyengine#2277 - Closes bevyengine#5081 ## Solution We now check that all entities with both a `Parent` and a `ComputedVisibility` component have parents that themselves have a `ComputedVisibility` component. Note that the warning is only printed once. We also add a similar warning to `GlobalTransform`. This only emits a warning. Because sometimes it could be an intended behavior. Alternatives: - Do nothing and keep repeating to newcomers how to avoid recurring pitfalls - Make the transform and visibility propagation tolerant to missing components (bevyengine#5616) - Probably archetype invariants, though the current draft would not allow detecting that kind of errors --- ## Changelog - Add a warning when encountering dubious component hierarchy structure Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
Bevy version
9f94f7e
Operating system & version
Arch Linux
What you did
spawn
, i.e., withoutTransform
andGlobalTransform
components.spawn_bundle
andPbrBundle
, setting the mesh, material, and transform fields (use..Default::default()
for the other fields)What you expected to happen
Since the parent entity didn't have either a
Transform
or aGlobalTransform
component, I would expect that the transform component in the child entity would be relative to the reference frame. If this had been the case, thetransform_propagate_system
should have set theGlobalTransform
component according to theTransform
component and the mesh should have been rendered at the offset provided in thePbrBundle
.What actually happened
The mesh renders at the origin (i.e., the transform field from the
PbrBundle
appears to have been ignored).Additional information
From the query in the
transform_propagate_system
, it appears that this system does not handle the case where the parent entity doesn't have aGlobalTransform
/Transform
component, but it's children do. Is this behavior intentional?The text was updated successfully, but these errors were encountered: