Render Mesh Only With Wireframe #19314
Unanswered
vertexcubed
asked this question in
Q&A
Replies: 1 comment
-
I don't think that there is a built-in way to achieve that. You best bet may be to do it manually with a system removing all your #[derive(Component, Clone, Debug, Deref, DerefMut)]
pub struct MeshMaterial3dStorage<M: Material>(pub Handle<M>);
fn enter_debug_mode<M: Material>(
mut commands: Commands,
keyboard_input: Res<ButtonInput<KeyCode>>,
mesh_entities: Query<(Entity, &MeshMaterial3d<M>), Without<NoWireframe>>,
) {
// TODO Use an observer/state/... instead of keyboard input
if keyboard_input.just_pressed(KeyCode::Space) {
for (e, mat_handle) in &mesh_entities {
commands
.entity(e)
.insert(MeshMaterial3dStorage(mat_handle.0.clone()));
commands.entity(e).remove::<MeshMaterial3d<M>>();
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Working on a project and I want to implement a debug rendering mode where meshes are only rendered with wireframe enabled and not their normal rendering, however I can't seem to figure out how. I tried just changing the Visibility on the entity but that also hides the wireframe too. Any simple way of implementing this?
Beta Was this translation helpful? Give feedback.
All reactions