fix(ai): map team-relative rotation actions

This commit is contained in:
Josh Creek
2026-08-08 14:54:27 +01:00
parent 7e217df898
commit 57a298dc06
4 changed files with 38 additions and 3 deletions
+4 -2
View File
@@ -75,11 +75,13 @@ func _decide() -> void:
_action.thrust.y = 0.0
else:
_action = ShipActionCodec.from_logits(out, action_noise)
_action = ShipActionCodec.apply_team_frame(_action, _ship.team)
# Find ship/ball/teammates/opponents/goal once everything is spawned.
# ShipAction axes are body-frame so only observations need team context
# (ShipObservations). Rosters never change mid-match (no despawn path exists
# ShipAction thrust axes are body-frame, while its rotation axes are mapped
# from the canonical team frame by ShipActionCodec. Rosters never change
# mid-match (no despawn path exists
# anywhere in this codebase), so this only needs to run once — sorted by
# spawn_index so a given ship keeps the same observation slot for the whole
# match, matching TrainingMode's identically-sorted lists.