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 <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user