From 78303cd0b05ab2ed9b2ef59bc7f90f58b239f23d Mon Sep 17 00:00:00 2001 From: Danny McGee Date: Thu, 28 Sep 2023 15:04:26 -0400 Subject: [PATCH] Make world-grid plane double-sided --- hello-world/src/test_scene.rs | 38 ++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/hello-world/src/test_scene.rs b/hello-world/src/test_scene.rs index 61f866d..9ae8741 100644 --- a/hello-world/src/test_scene.rs +++ b/hello-world/src/test_scene.rs @@ -59,18 +59,36 @@ fn spawn_scene( }); // Plane + let plane = meshes.add(Mesh::from(shape::Plane { + size: 200.0, + subdivisions: 0, + })); + let proc_grid = mat_proc_grid.add(ProceduralGridMaterial {}); + cmd.spawn(( - MaterialMeshBundle { - mesh: meshes.add(Mesh::from(shape::Plane { - size: 200.0, - subdivisions: 0, - })), - material: mat_proc_grid.add(ProceduralGridMaterial {}), - ..default() - }, - NotShadowCaster, + SpatialBundle::from_transform(Transform::IDENTITY), WorldGridPlane, - )); + )) + .with_children(|parent| { + parent.spawn(( + MaterialMeshBundle { + mesh: plane.clone(), + material: proc_grid.clone(), + transform: Transform::IDENTITY, + ..default() + }, + NotShadowCaster, + )); + parent.spawn(( + MaterialMeshBundle { + mesh: plane, + material: proc_grid, + transform: Transform::IDENTITY.looking_to(Vec3::Z, Vec3::NEG_Y), + ..default() + }, + NotShadowCaster, + )); + }); } fn move_plane_with_camera(