-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Getting an entity's children #513
Comments
This feature already exists in the engine: simply acquire the However, this should be better documented. Maybe a general example on hierarchies could help? |
@Moxinilian That did the trick, thanks! This would be a great thing to document, indeed. |
Agreed. Lets consider a new extended "hierarchy" example the exit criteria for this issue. |
Is there documentation on this now? How do I access the Component |
@nablabla this example should help: https://github.com/bevyengine/bevy/blob/main/examples/ecs/hierarchy.rs |
@Moxinilian not really, I have some entity that I just created, now I want to change the camera layer of it and all its children recursively. The example makes a query of existing entities. But I want to access an entity that I just created before I return from the function where I create them. |
If you move an entity from one parent to another, the children will follow as they are attached in a tree-like fashion. Would getting the entity ID of your newly created entity and attaching it to the entity of interest to you work? |
ne, because "moving an entity to another camera layer" is not really moving it anywhere but rather adding a frame bundle to it which does that. And it also makes sense, that the engine does not treat this recursively. Because I think some one might want to have an entity with children distributed on multiple layers. |
I'm writing a simple test game with Bevy, and I'm using the parent/child structure to add a child entity containing SpriteComponents to the player entity. Now I have a system that takes the Player entity and updates it. However, when I want to update the sprite from this system, there appears to be no way to do this, since I cannot access the child entity holding the sprite components. It would be nice to have a
get_children
function to iterate over all children of a certain entity.I could add the SpriteComponents directly to the player, but this seems very messy, since it'll pollute the player's components with the components of the sprite (components like
Material
,Draw
,MainPass
,RenderPipelines
, etc should be encapsulated in a child entity).The text was updated successfully, but these errors were encountered: