Skip to content

Commit

Permalink
Fix material alpha_mode in example global_vs_local_translation (#6658)
Browse files Browse the repository at this point in the history
# Objective

The global_vs_local_translation example tries to use transparency to identify static cubes, but the materials of those cubes aren't transparent.

## Solution

Change material alpha_mode to  `AlphaMode::Blend` for those cubes.
  • Loading branch information
holyfight6 committed Dec 1, 2022
1 parent 8faa12c commit e89b043
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions examples/transforms/global_vs_local_translation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ fn setup(
.spawn((
PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
material: materials.add(Color::YELLOW.into()),
material: materials.add(StandardMaterial {
base_color: Color::YELLOW,
alpha_mode: AlphaMode::Blend,
..Default::default()
}),
..default()
},
ChangeGlobal,
Expand All @@ -69,7 +73,11 @@ fn setup(
child_builder.spawn((
PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 0.5 })),
material: materials.add(Color::RED.into()),
material: materials.add(StandardMaterial {
base_color: Color::RED,
alpha_mode: AlphaMode::Blend,
..Default::default()
}),
transform: Transform::from_translation(Vec3::Y - Vec3::Z),
..default()
},
Expand All @@ -80,7 +88,11 @@ fn setup(
child_builder.spawn((
PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 0.5 })),
material: materials.add(Color::GREEN.into()),
material: materials.add(StandardMaterial {
base_color: Color::GREEN,
alpha_mode: AlphaMode::Blend,
..Default::default()
}),
transform: Transform::from_translation(Vec3::Y + Vec3::Z),
..default()
},
Expand Down

0 comments on commit e89b043

Please sign in to comment.