diff --git a/crates/render/shaders/ui.wgsl b/crates/render/shaders/ui.wgsl index d075502..ce88b39 100644 --- a/crates/render/shaders/ui.wgsl +++ b/crates/render/shaders/ui.wgsl @@ -48,10 +48,10 @@ fn vertex_main( vertex.position.y * scale ); - // Apply rotation + // Apply rotation (and adjust sprite angle, since sprites point north) pos = mat2x2( - vec2(cos(instance.angle), sin(instance.angle)), - vec2(-sin(instance.angle), cos(instance.angle)) + vec2(cos(instance.angle - 1.5708), sin(instance.angle - 1.5708)), + vec2(-sin(instance.angle - 1.5708), cos(instance.angle - 1.5708)) ) * pos; // Correct for screen aspect, preserving height diff --git a/crates/render/src/ui/radar.rs b/crates/render/src/ui/radar.rs index e03a470..f7506c6 100644 --- a/crates/render/src/ui/radar.rs +++ b/crates/render/src/ui/radar.rs @@ -227,7 +227,7 @@ impl Radar { (radar_size / -2.0 - 10.0) + d.y, ) .into(), - angle: 0.0, + angle: to_radians(90.0), size, color, sprite_index: sprite.get_index(), @@ -245,7 +245,7 @@ impl Radar { (radar_size / -2.0 - 10.0) - d.y, ) .into(), - angle: to_radians(90.0), + angle: to_radians(180.0), size, color, sprite_index: sprite.get_index(), @@ -263,7 +263,7 @@ impl Radar { (radar_size / -2.0 - 10.0) - d.y, ) .into(), - angle: to_radians(180.0), + angle: to_radians(270.0), size, color, sprite_index: sprite.get_index(), @@ -281,7 +281,7 @@ impl Radar { (radar_size / -2.0 - 10.0) + d.y, ) .into(), - angle: to_radians(270.0), + angle: to_radians(0.0), size, color, sprite_index: sprite.get_index(),