Grass Cutters Together: the project as of moon-sweepers f3666f0

A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and
Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date.
Images, audio, models and binaries go through Git LFS (.gitattributes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiemandKG
2026-11-06 18:44:40 +06:00
parent 0f0467cd0c
commit d1c3761e58
4190 changed files with 270757 additions and 1 deletions

View File

@ -0,0 +1,41 @@
using System.Collections.Generic;
using UnityEngine;
namespace GrassCutter
{
/// <summary>
/// Remembers the imported local rotation of model parts (Blender FBX nodes carry a 90° X rotation) so procedural
/// animation can rotate *on top of* it instead of overwriting it.
/// </summary>
public static class BaseRot
{
static readonly Dictionary<Transform, Quaternion> _base = new Dictionary<Transform, Quaternion>();
public static Quaternion Of(Transform t)
{
if (!t) return Quaternion.identity;
if (!_base.TryGetValue(t, out var q))
{
q = t.localRotation;
_base[t] = q;
if (_base.Count > 4096) Prune();
}
return q;
}
/// <summary>Which local axis (0=x,1=y,2=z) of t points along the given world direction.</summary>
public static int LocalAxisFor(Transform t, Vector3 worldDir)
{
var l = t.InverseTransformDirection(worldDir);
l = new Vector3(Mathf.Abs(l.x), Mathf.Abs(l.y), Mathf.Abs(l.z));
return l.x >= l.y && l.x >= l.z ? 0 : (l.y >= l.z ? 1 : 2);
}
static void Prune()
{
var dead = new List<Transform>();
foreach (var k in _base.Keys) if (!k) dead.Add(k);
foreach (var d in dead) _base.Remove(d);
}
}
}