commit 06e71271861e37d2057e415134ce61baa8f44d63
parent cb2cfed9c89fccfe3827a21e95c9c8b2cd6e7208
Author: William Casarin <jb55@jb55.com>
Date: Fri, 27 Feb 2026 08:26:36 -0800
nostrverse: fix rotation editor euler decomposition and tilemap z-fighting
to_euler(YXZ) returns (Y, X, Z) but the rotation editor and drag-snap
code destructured as (_, y, _), reading the X angle instead of Y.
Also bump the tilemap Y offset from 0.001 to 0.01 so depth buffer
can distinguish it from the grid plane.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/crates/notedeck_nostrverse/src/room_view.rs b/crates/notedeck_nostrverse/src/room_view.rs
@@ -320,7 +320,7 @@ pub fn show_room_view(
let angle = delta_x * ROTATE_SENSITIVITY;
let new_rotation = Quat::from_rotation_y(angle) * obj.rotation;
let new_rotation = if state.grid_snap_enabled {
- let (_, y, _) = new_rotation.to_euler(glam::EulerRot::YXZ);
+ let (y, _, _) = new_rotation.to_euler(glam::EulerRot::YXZ);
let snap_rad = state.rotation_snap.to_radians();
let snapped_y = (y / snap_rad).round() * snap_rad;
Quat::from_rotation_y(snapped_y)
@@ -563,7 +563,7 @@ fn render_object_inspector(
obj.scale = Vec3::new(sx, sy, sz);
// Editable Y rotation (degrees)
- let (_, angle_y, _) = obj.rotation.to_euler(glam::EulerRot::YXZ);
+ let (angle_y, _, _) = obj.rotation.to_euler(glam::EulerRot::YXZ);
let mut deg = angle_y.to_degrees();
let rot_changed = ui
.horizontal(|ui| {
diff --git a/crates/notedeck_nostrverse/src/tilemap.rs b/crates/notedeck_nostrverse/src/tilemap.rs
@@ -237,7 +237,7 @@ pub fn build_tilemap_model(
// Center the tilemap so origin is in the middle
let offset_x = -(w as f32) / 2.0;
let offset_z = -(h as f32) / 2.0;
- let y = 0.001_f32; // Just above ground to avoid z-fighting with grid
+ let y = 0.01_f32; // Above ground plane to avoid z-fighting with grid
let normal = [0.0_f32, 1.0, 0.0]; // Facing up
let tangent = [1.0_f32, 0.0, 0.0, 1.0]; // Tangent along +X