-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
QueryBuilder
is largely unusable due to keeping a reference to the World
#15520
Comments
I would argue that Instead, you'll likely want to query |
@SkiFire13 Thanks for the details. Fair enough, I may be misunderstanding what So, out of curiosity, what's the use case for I've looked at |
From what I understand it is supposed to create queries based on some runtime data, but not every frame. Possible usecases include e.g. systems defined in scripting languages.
Yeah that sounds better for what you're doing. The collection step sounds a bit unfortunate, though it will be hard to avoid. I think |
Ok but if not every frame, how do you store something which references the |
|
Ok so my problem with all of this is that once you queried the EDIT: Nevermind, I forgot that you can access all components of the entity with |
Yes, it has only been added recently |
Yeah my suspicion is that |
What problem does this solve or what need does it fill?
The documentation of
QueryBuilder
claims it can build aQueryState
at runtime. However unlikeQueryState
, the builder retains a reference to theWorld
. This means it can't be stored. This also means no other query can be done on the world at the same time, for example to resolve anotherEntity
returned by theQueryBuilder
result. This heavily restricts where and howQueryBuilder
can be used.What solution would you like?
Like
QueryState
but dynamic, without a world reference. When actually iterating, then take the targetWorld
as parameter to a method.What alternative(s) have you considered?
There's no alternative I know of.
Additional context
Currently
bevy_tweening
makes heavy use of generics to be able to define systems and behaviors based on the target component being animated. This has been a source of pain since day one. The hope was to eventually abandon this once dynamic queries are available in Bevy, so that a single animation system can process an heterogeneous list of animation targets. Unfortunately, trying to implement this showed this is impossible due to theQueryBuilder
limitation of taking aWorld
reference; the animator class references a component/entity pair to animate, but once the query builder is in scope it references the world, making it impossible to query and animate (mutate) that target component.The text was updated successfully, but these errors were encountered: