From 61ce6683831f929e25552e31f09e4f589fa2faf1 Mon Sep 17 00:00:00 2001 From: "Elijah C. Voigt" Date: Wed, 8 Nov 2023 19:48:58 -0800 Subject: [PATCH] it was z-stackinggit add .; git status duhgit add .; git status --- src/display2d.rs | 16 +++++++++++++--- src/display3d.rs | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/display2d.rs b/src/display2d.rs index f690311..a0171da 100644 --- a/src/display2d.rs +++ b/src/display2d.rs @@ -232,17 +232,27 @@ fn set_tile_sprite( /// Sets a piece location given it's board index fn set_transform( mut events: Query< - (&mut Transform, &BoardIndex), + (&mut Transform, &BoardIndex, Option<&Piece>, Option<&Tile>), ( With, Or<(Changed, Added)>, ), >, ) { - events.iter_mut().for_each(|(mut t, i)| { + events.iter_mut().for_each(|(mut t, i, piece, tile)| { let x = SCALE * 16.0 * ((i.x as f32) - 3.5); let y = SCALE * 16.0 * ((i.y as f32) - 1.5); - *t = Transform::from_scale(Vec3::splat(SCALE)).with_translation(Vec3::new(x, y, 0.0)); + let z = match (piece, tile) { + (None, None) | (Some(_), Some(_)) => { + error!("Entity with BoardIndex is neither a Piece nor a Tile!"); + 0.0 + } + // Piece + (Some(_), None) => 2.0, + // Tile + (None, Some(_)) => 1.0, + }; + *t = Transform::from_scale(Vec3::splat(SCALE)).with_translation(Vec3::new(x, y, z)); debug!("setting position of {:?} to {:?}", i, t); }); } diff --git a/src/display3d.rs b/src/display3d.rs index a138a75..e56e0bd 100644 --- a/src/display3d.rs +++ b/src/display3d.rs @@ -189,7 +189,7 @@ fn hydrate_camera( hdr: true, ..default() }, - transform: Transform::from_xyz(0.0, 20.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y), + transform: Transform::from_xyz(0.0, 12.5, 6.0).looking_at(Vec3::ZERO, Vec3::Y), dither: DebandDither::Enabled, color_grading: ColorGrading { ..default() }, ..default()