-
Im trying to use the retained gizmo to render 10k+ orbits. These orbits will not change in most of the time, but I still need some way to create/remove some orbits. When program started, orbits are created from data. Then some orbits may be created/removed by user through some python code. So I need a way to efficiently add a batch of orbits, remove some orbits, even add/remove a sequence of orbits one by one. The first solution I thought was recreate Gizmo component whenever a orbit is created, but performance may be a problem. Then I tried to attach every orbit entity a Gizmo component, still, the performance is bad than immediate gizmos. Is there any way to solve this problem? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is the intended usage of retained gizmos. You create an Entity when you need to draw one, and despawn the Entity when you don't need it anymore. You can optionally not despawn the Entity and just update the Gizmo Component.
This seems weird, performances were worse with all orbits as retained gizmos compared to drawing them all as immediate gizmos ? Note: If line gizmos performances really end up being a problem you could be interested by https://github.com/ForesightMiningSoftwareCorporation/bevy_polyline. Beware it is still on Bevy v0.15.0 though. |
Beta Was this translation helpful? Give feedback.
Oh my bad, you should definitely try the approach 1, it might end up just fine if your updates are infrequent enough (human interactions).
If updates take too long, try batching your gizmos in a few batch entities, and tweak the batch size (10,100,1000, ...). This way you'(d have a best of both worlds: fast rendering with a few gizmos entities, but fast updates due to only updating a few batches instead of every gizmos.