#how do you "query bundles"?

14 messages · Page 1 of 1 (latest)

rose tide
#

I am aware that bundles are supposed to just be a simplification/easy spawning template, but i am consistently finding myself having to try to query for specific bundles rather than over a generic component. in this case, i want to specifically update the position of a sprite, but sprites come in SpriteBundles, and i have no idea how to filter the query to only get sprite transforms and not everything else. am i missing something? or am i just approaching the problem from the wrong perspective?

shut leaf
rose tide
#

as far as im aware, calling commands.spawn generates a single entity over the given components, does the spawn method just destructure the bundle into its components and then connect them together as an entity?

shut leaf
#

pretty much, yeah

rose tide
#

so when i query for transforms, how would i specifically filter for entities that have sprites in them?

shut leaf
#

use a tuple with both transform and sprite, so Query<(&Transform, &Sprite)>
or whatever the components are called

rose tide
#

so essentially, for every bundle, i look up some specific component it contains, then use that in the query?

shut leaf
#

just forget bundle exists

rose tide
#

alright

shut leaf
#

you query for an entity that has all components listed in a tuple, with an optional filter

pallid viper
rose tide
#

yeah that's what i went for

#

ty