From 085249b5c456093687c52e30af22fd52cf256bed Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 16 Mar 2026 08:18:28 -0400 Subject: [PATCH] Fix: model facing default (south/+Z) + clear game state on rematch Model facing: GLB models exported from Blender arrive in Godot facing +Z, not -Z. Changed _facing_to_base_angle default case from 0 (north/-Z) to PI (south/+Z). Explicit "north" case added. Updated admin dropdown label from "Default (north)" to "Default (south / Blender GLB)" to match. Stale game state: when matchmaking.match_found is received, clear Game.state so the new GameScreen always calls send_ready() rather than rendering the previous (ended) game's state. Fixes same-players-re-match ending up in the already-completed session. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- Client/origin-client/autoloads/Game.gd | 1 + Client/origin-client/scenes/game/game_screen.gd | 6 ++++-- .../src/SOR.Admin/Components/Pages/Cards/CardEditor.razor | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Client/origin-client/autoloads/Game.gd b/Client/origin-client/autoloads/Game.gd index 90c8133..b56cbab 100644 --- a/Client/origin-client/autoloads/Game.gd +++ b/Client/origin-client/autoloads/Game.gd @@ -257,6 +257,7 @@ func _on_server_push(type: String, payload: Variant) -> void: var sid : String = str(d.get("gameSessionId", "")) var oname : String = str(d.get("opponentDisplayName", "Opponent")) var orank : int = int(d.get("opponentRankScore", 0)) + state = {} # Clear any stale previous-game state before new session starts session_id = sid opponent_name = oname match_found.emit(sid, oname, orank) diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index d9f933e..8e28e5e 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -811,12 +811,14 @@ func _resolve_anim_track(ap: AnimationPlayer, action_lower: String) -> String: ## Convert a model's exported facing direction string to a base angle in radians. ## The angle represents atan2(dir.x, -dir.z) for the direction the model faces ## when rotation.y == 0. All animations and movement share this offset. +## GLB models exported from Blender arrive in Godot facing +Z (south) by default, +## so "south" / unset / null all map to PI. Explicitly pass "north" for -Z models. func _facing_to_base_angle(facing: String) -> float: match facing.to_lower(): - "south": return PI + "north": return 0.0 # model faces -Z (Godot's natural forward) "east": return PI / 2.0 "west": return -PI / 2.0 - _: return 0.0 # "north" / default: model faces -Z + _: return PI # "south" / default / null — model faces +Z (Blender GLB) ## Returns the rotation.y (radians) that makes a unit's model face its opponent ## across the board, given its stored base angle and team-flip flag. diff --git a/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor b/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor index f24634b..04ed2fc 100644 --- a/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor +++ b/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor @@ -309,7 +309,7 @@ else