komadori / bevy_mod_outline

Apache License 2.0
119 stars 10 forks source link

Outline visible on hidden object #28

Closed keis closed 7 months ago

keis commented 9 months ago

In a change from how 0.5.1 worked the outline of hidden objects are being shown with 0.6.0 of bevy_mod_outline. This can be observed by modifying the shapes example and running on both versions.

diff --git a/examples/shapes.rs b/examples/shapes.rs
index 96ed028..0d26074 100644
--- a/examples/shapes.rs
+++ b/examples/shapes.rs
@@ -55,18 +55,19 @@ fn setup(
     // Add torus using the regular surface normals for outlining
     commands
         .spawn(PbrBundle {
             mesh: meshes.add(Mesh::from(Torus {
                 radius: 0.3,
                 ring_radius: 0.1,
                 subdivisions_segments: 20,
                 subdivisions_sides: 10,
             })),
+            visibility: Visibility::Hidden,
             material: materials.add(Color::rgb(0.9, 0.1, 0.1).into()),
             transform: Transform::from_xyz(0.0, 1.2, 2.0)
                 .with_rotation(Quat::from_rotation_x(0.5 * PI)),
             ..default()
         })
         .insert(OutlineBundle {
             outline: OutlineVolume {
                 visible: true,
                 colour: Color::rgba(1.0, 0.0, 1.0, 0.3),
komadori commented 9 months ago

Thanks for reporting. I will make a minor release soon to fix this.

Funnily enough, I didn't think that Visibility worked in previous releases and it was on my mental to-do list to look into. I guess perhaps it appeared to work because the assets weren't extracted if the mesh wasn't visible, but that is no longer the case for outlines.

komadori commented 7 months ago

Fixed by 70847d7d5db5a1f84f451738cca441cf484f3b8b and released in 0.6.1. Sorry it took so long.

keis commented 7 months ago

Awesome 😎