Per entity/collider debug rendering
I needed a way to toggle debug rendering of colliders for group of entities in my project, so I thought of implementing it kind of like bevy Wireframe works, with global flag in resource, and if it's off, then per entity with marker component. I also considered just using Visibility for collider entities, but that's seems unintuitive.
~Oh, I also fixed RapierDebugRenderPlugin::enabled not being used, I'm not sure if creating context with enabled: true was intentional or just a typo.~ (fixed in recent master)
Is there any way to elevate "draw only entities with ColliderDebug components" to a system, and have a global system and a selective one, and bail out at the start of either, instead of doing this per-line?
I think no, there is no way. Well I don't see any, since rendering is done by DebugRenderPipeline which is using whole RigidBodySet, ColliderSet, etc. So it seems I can't use Queries to filter what to render before calling a .render fn, only in the process.
Overall a good idea/impl imo :)
I think adding a per-entity "DebugRenderMode" would be useful in the future as well, but I think getting this in first would be preferable.
I have updated this PR once again, I wonder if anything is blocking this PR from being merged ? Would really like to get this feature into the library !
I have updated this PR once again, I wonder if anything is blocking this PR from being merged ? Would really like to get this feature into the library !
Thanks for the pull request!
I like it overall, I, too, would have appreciated a more customizable approach, to more easily switching from different modes/selection, maybe https://github.com/bevyengine/bevy/pull/7328 is interesting to take inspiration from it.
In the meanwhile, this is an acceptable implementation for me.
An example and changelog would be great !
I initially based this PR on how Wireframe worked, but that was a long time ago. I'm happy to update it so it would have AlwaysRender/NeverRender to mimic the modern Wireframe, looks straightforward enough. And since I have weekends now, I hope to be done shortly !
@Vrixyz I've rewrote this PR to mirror bevy's Wireframe (hopefully) and added a changelog, a while back actually, just updated the branch. Couldn't add an example, because I'm a little bit burned out from this PR (I just pray that it will be upstreamed this time :pray: )
Thanks!