Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

fix(unity): the town landmarks stand upright (#979)

Eyal Golan6c54c9531c98
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a1bd0566..6f57e812a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,10 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
target follows with its pool (#781).
### Fixed
+- MATKOT's nine whole-town landmarks stand upright (refs #663, #917; owner, 18 October 2026: the models "seem to be on
+ their side on the map"). Every Collection Far prefab's root carries the FBX axis conversion (-90 degrees about X),
+ and `TownLandmarks` set the rotation to the yaw alone, which overwrote it; the yaw now goes on top of the prefab's own
+ rotation, as `RouteTrain` already does.
- Under `?lang=he` the hex info panel names its towns and 1948 localities in Hebrew: the title, the "Settlements"
line and the 1948 name in the localities line read the row's `name_he`, and the English name where a row has none
(13 of 271 localities). Where the Hebrew 1948 and today names are one word (48 rows that would otherwise show
diff --git a/unity/Assets/Scripts/Map/Collection/TownLandmarks.cs b/unity/Assets/Scripts/Map/Collection/TownLandmarks.cs
index dd68177fe..1f54573b0 100644
--- a/unity/Assets/Scripts/Map/Collection/TownLandmarks.cs
+++ b/unity/Assets/Scripts/Map/Collection/TownLandmarks.cs
@@ -264,7 +264,10 @@ namespace Statecraft.Game.Map.Collection
taken.Add((at.Value, r));
var go = Instantiate(prefab!, transform, false);
go.name = w.Key;
- go.transform.rotation = Quaternion.Euler(0f, YawOf(w.Model), 0f);
+ // The yaw goes on top of the prefab's own rotation: every Collection Far prefab's root carries the FBX axis
+ // conversion (-90 degrees about X; bakeAxisConversion is off), and setting the yaw alone laid each model on its
+ // side (owner, 18 October 2026: the models "seem to be on their side on the map").
+ go.transform.localRotation = Quaternion.Euler(0f, YawOf(w.Model), 0f) * prefab!.transform.localRotation;
var bounds = Bounds(go);
float edge = Mathf.Max(bounds.size.x, bounds.size.z);
go.transform.localScale *= edge > 1e-3f ? SizeM / edge : 1f;
diff --git a/unity/Assets/Tests/EditMode/TownLandmarksTests.cs b/unity/Assets/Tests/EditMode/TownLandmarksTests.cs
index 68c476426..b8214964b 100644
--- a/unity/Assets/Tests/EditMode/TownLandmarksTests.cs
+++ b/unity/Assets/Tests/EditMode/TownLandmarksTests.cs
@@ -133,6 +133,46 @@ public class TownLandmarksTests
Assert.AreEqual(CameraController.MaxDistance, 250000f, "the overview is within the camera's reach");
}
+ /// <summary>Owner, 18 October 2026: the models "seem to be on their side on the map". Every Collection Far prefab's root
+ /// carries the FBX axis conversion (-90 degrees about X; the .fbx.meta files have bakeAxisConversion 0), so a landmark
+ /// must keep the prefab's own rotation under its yaw: its rotation is the yaw times the prefab's, and its height on the
+ /// map is the model's own height (at the landmark's scale), not its length.</summary>
+ [Test]
+ public void EveryLandmarkStandsUprightAsItsModelDoes()
+ {
+ var map = OpenMap();
+ var c = ContentLoader.Load(Statecraft.Game.Paths.Content);
+ var t = TownLandmarks.ShowAt(map, new DateTime(1949, 1, 1), Array.Empty<Placement>(), c)!;
+ AnswerAll();
+ Assert.Greater(t.Placed.Count, 0);
+ var heights = new Dictionary<string, float>();
+ foreach (var (key, model, _) in t.Placed)
+ {
+ var prefab = Far(model);
+ var child = t.transform.Find(key);
+ Assert.IsNotNull(child, key);
+ var want = t.transform.rotation * Quaternion.Euler(0f, TownLandmarks.YawOf(model), 0f) * prefab.transform.localRotation;
+ Assert.Less(Quaternion.Angle(want, child!.rotation), 0.01f, $"{key} ({model}) keeps its prefab's rotation under its yaw");
+ if (!heights.TryGetValue(model, out var h))
+ {
+ // The model as its prefab stands (unparented, its own rotation): a yaw about the vertical keeps this height.
+ var probe = Object.Instantiate(prefab);
+ try { heights[model] = h = WorldBounds(probe).size.y / probe.transform.localScale.y; }
+ finally { Object.DestroyImmediate(probe); }
+ }
+ float scale = child.localScale.y;
+ Assert.AreEqual(h * scale, WorldBounds(child.gameObject).size.y, 0.01f * h * scale, $"{key} ({model}) is as tall as its model");
+ }
+ }
+
+ static Bounds WorldBounds(GameObject go)
+ {
+ var rs = go.GetComponentsInChildren<Renderer>(true);
+ var b = rs[0].bounds;
+ foreach (var r in rs) b.Encapsulate(r.bounds);
+ return b;
+ }
+
[Test]
public void ASpotIsTheFirstFreeOneAndNoneWhenAllAreTaken()
{