Closed YegorStolyarov closed 1 year ago
Hey there, thanks for asking.
As it stands right now, it could only provide a possibly out of date copy of the component, as the datrastructure storing entities has to have a lifetime independent of the ECS.
That means i could only provide a TrackedComponent
instead of a &TrackedComponent
. Storing this extra data is also likely to cause a drop in performance (something which is already not ideal and i'm working on improving)
So with that in mind, sorry, i'm not planning on that. if anything, the tools provided by the ECS will improve enough to make this easier in the future (relations or native indexing)
The problem:
while working with this useful crate, sometimes I need to get more data from nearby entities. The obvious component to store this data is the component used to build KDTree. For example, when I use custom
Collider
component to track entities, it would be nice to store collision radius in it. But when I getting nearby result, I have only position and entity, having to do an additional query request.Suggested solution.
add new feature to include tracked component, when enabled, making result be like
(Vec2, Option<Entity>, &TrackedComponent)
. I don`t know inner kitchen of the crate, if the component still cannot be retrieved without additional querying, then my suggestion has no sence . Maybe there is some alternative approach.