amethyst / specs

Specs - Parallel ECS
https://amethyst.github.io/specs/
Apache License 2.0
2.49k stars 219 forks source link

How to get an entt like view of entities within a system? #743

Closed BlidDev closed 2 years ago

BlidDev commented 2 years ago

Hi, I have a system called BulletSystem that takes Transform and BulletData components. In this system I need to check if the bullet entity collides with any entity that has the Transform and EnemyData components. Is there anything like view in entt that just gives you a list of the entities with the required components and the ability to retrieve their components? Because I didn't see anyware a way to do that within a system.

Thanks!

zesterer commented 2 years ago

Simply join over the components you care about and iterate through them: https://specs.amethyst.rs/docs/tutorials/08_join.html#joining-components.

BlidDev commented 2 years ago

I apparently didn't understand the idea of SystemData fully yet. Thanks for your time nevertheless!