Add Unity importer scripts and handle CityJSON transform

This commit is contained in:
s0wlz (Matthias Puchstein)
2026-01-14 19:40:16 +01:00
parent 81da307d65
commit 73ec27e3b7
4 changed files with 1986 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
using UnityEditor;
using UnityEngine;
public static class GeoBoundsDebug
{
[MenuItem("Tools/Geo/Print Selected Mesh Bounds")]
public static void PrintSelectedMeshBounds()
{
foreach (var go in Selection.gameObjects)
{
var mf = go.GetComponent<MeshFilter>();
if (mf == null || mf.sharedMesh == null)
{
Debug.Log($"{go.name}: no MeshFilter/mesh");
continue;
}
var mesh = mf.sharedMesh;
var b = mesh.bounds;
// Mesh bounds are in local mesh space
var centerWorld = go.transform.TransformPoint(b.center);
// Approximate size in world space (ignores rotation, good enough for diagnosis)
var lossy = go.transform.lossyScale;
var sizeWorld = new Vector3(
Mathf.Abs(b.size.x * lossy.x),
Mathf.Abs(b.size.y * lossy.y),
Mathf.Abs(b.size.z * lossy.z)
);
Debug.Log($"{go.name}: worldCenter={centerWorld}, worldSize={sizeWorld}");
}
}
}