bevy_mod_raycast icon indicating copy to clipboard operation
bevy_mod_raycast copied to clipboard

Intersection API suggestion

Open Shatur opened this issue 2 years ago • 0 comments

Problem description

Currently intersection inserted into a separate entity:

https://github.com/aevyrie/bevy_mod_raycast/blob/5949fc7f021e6900c3d14b4e6f22ef4426489441/src/lib.rs#L517-L519

But this behavior is not very expected. In a game with menu, users will need to remove such entities manually when exiting a game session. And since the Intersection component is added to a new entity, users do not have access to information about which entity was intersected (they have to use RayCastSource::intersect_list()), which makes this component not very useful.

Suggestion

I would suggest to just remove Intersection component and its system at all since this information already available in RayCastSource to avoid needless synchronization and duplication.

Shatur avatar Aug 26 '22 08:08 Shatur