How to depict an Entity owning other Entities #105
-
Take for instance a Aeroplane Entity owning multiple Weapon Entities. What is the best way to depict this relationship |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The best way to solve your problem is to use filters. This article will show how to use them: https://www.sebaslab.com/svelto-ecs-3-3-and-the-new-filters-api/ in this case, you would need to use persistent filters. The aeroplane component would hold the id of the persistent filter that holds the indices of its weapons. in short, a filter is a way to subset groups using double array indexing. A group is a set of entities and the components are stored in linear arrays the subset is defined as |
Beta Was this translation helpful? Give feedback.
The best way to solve your problem is to use filters. This article will show how to use them:
https://www.sebaslab.com/svelto-ecs-3-3-and-the-new-filters-api/
in this case, you would need to use persistent filters. The aeroplane component would hold the id of the persistent filter that holds the indices of its weapons.
in short, a filter is a way to subset groups using double array indexing.
A group is a set of entities and the components are stored in linear arrays
a filter is an array of indices of these component arrays, so a way to subset the component arrays.
the subset is defined as
componentArray[filterArray[i]]