Round 6 fixes: held tools, headlamp glare, ladder openings, level horizon, roof hulls, rain hits, idle motion, belt packs, meadow variety
- Held tools sit lower and further right; the hammer faces forward and strikes about the camera's right - Headlamp leaves held items, treats and vending machines alone (rendering layer NoLamp); other lights keep lighting them - Hay grounded on the floor in world space (it floated) - Deck fence opens at each ladder, rail colliders split around it; ladders moved to 2 m off the edge middle, clear of the intakes; climbing goes over a rail only if one is in the way - Crew stand to the soil's up (Planet.Level): flat round the base, the ball's up past it, so the horizon stays level on a small planet - Convex roof hulls for the crew cabin, garage, pitched roof and windmill tower; cabin box lowered to the eaves - Rain and acid rain hits differ by surface: soil, grass, wood, metal - Idle motion: dishes pan, sways sway, sensors turn, eyes blink, windmill turns in the breeze, reels and parked rotors tick over - Belt: take tools off at the supply wall; hold E at a vending machine for a pack of 3 on the belt, LMB has one - New meadow pieces: boulders, slab stones, crystals, mushrooms, stump, bulb plants - -demofix checks for all of the above; loc rows in all 11 tables Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -22,12 +22,28 @@ namespace GrassCutter
|
||||
// a sweep turns the whole rig around this point, by this much either way of the middle of the stroke
|
||||
public Vector3 pivot;
|
||||
public float arc, middle;
|
||||
// the model turned about its own handle, so the business end faces where it should
|
||||
public float spin;
|
||||
}
|
||||
|
||||
class Rig
|
||||
{
|
||||
public Hold hold;
|
||||
public Transform root, bladeA, bladeB;
|
||||
public Transform mesh;
|
||||
public Quaternion meshRot;
|
||||
public Vector3 handle;
|
||||
}
|
||||
|
||||
/// <summary>Every tool sits this much lower and further right than its pose says: out of the middle of the view.</summary>
|
||||
static readonly Vector3 Shift = new Vector3(0.045f, -0.05f, 0f);
|
||||
|
||||
/// <summary>Turns a tool about its handle (the longest side of its mesh), on top of its pose's own spin.</summary>
|
||||
public static void Spin(ToolId id, float degrees)
|
||||
{
|
||||
var vm = FindAnyObjectByType<ViewModel>();
|
||||
if (vm && vm._rigs.TryGetValue(id, out var r) && r.mesh)
|
||||
r.mesh.localRotation = r.meshRot * Quaternion.AngleAxis(r.hold.spin + degrees, r.handle);
|
||||
}
|
||||
|
||||
static readonly Hold[] Holds =
|
||||
@ -57,8 +73,8 @@ namespace GrassCutter
|
||||
pos = new Vector3(0.32f, -0.1f, 0.36f), euler = new Vector3(9f, -22f, 0f),
|
||||
usePos = new Vector3(0.32f, -0.11f, 0.36f), useEuler = new Vector3(11f, -22f, 0f),
|
||||
pivot = new Vector3(0.1f, -0.6f, -0.1f), arc = 28f, middle = 5f },
|
||||
// the hammer stands up beside the view, face to the left, ready to come down on what's being built
|
||||
new Hold { id = ToolId.Hammer, motion = Motion.Strike, scale = 0.42f,
|
||||
// the hammer stands up beside the view, face forward, ready to come down on what's being built
|
||||
new Hold { id = ToolId.Hammer, motion = Motion.Strike, scale = 0.42f, spin = 270f,
|
||||
pos = new Vector3(0.27f, -0.2f, 0.42f), euler = new Vector3(-68f, -10f, -8f),
|
||||
usePos = new Vector3(0.27f, -0.2f, 0.42f), useEuler = new Vector3(-68f, -10f, -8f) },
|
||||
};
|
||||
@ -102,7 +118,17 @@ namespace GrassCutter
|
||||
if (t.name == "BladeA") r.bladeA = t;
|
||||
else if (t.name == "BladeB") r.bladeB = t;
|
||||
}
|
||||
var mf = model ? model.GetComponentInChildren<MeshFilter>() : null;
|
||||
if (mf && mf.sharedMesh)
|
||||
{
|
||||
var size = mf.sharedMesh.bounds.size;
|
||||
r.mesh = mf.transform;
|
||||
r.meshRot = mf.transform.localRotation;
|
||||
r.handle = size.x >= size.y && size.x >= size.z ? Vector3.right : size.y >= size.z ? Vector3.up : Vector3.forward;
|
||||
if (h.spin != 0f) r.mesh.localRotation = r.meshRot * Quaternion.AngleAxis(h.spin, r.handle);
|
||||
}
|
||||
SetLayer(r.root, Layers.ViewModel);
|
||||
DayNight.KeepOutOfLamp(r.root.gameObject);
|
||||
r.root.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
@ -266,8 +292,8 @@ namespace GrassCutter
|
||||
: _strike < 0.12f ? Mathf.Lerp(-26f, 50f, Mathf.Pow((_strike - 0.06f) / 0.06f, 2f))
|
||||
: _strike < 0.2f ? 50f + Mathf.Sin((_strike - 0.12f) / 0.08f * Mathf.PI * 3f) * 4f * (1f - (_strike - 0.12f) / 0.08f)
|
||||
: Mathf.Lerp(50f, 0f, Mathf.SmoothStep(0f, 1f, (_strike - 0.2f) / 0.36f));
|
||||
rot = Quaternion.AngleAxis(a, Vector3.forward) * rot;
|
||||
pos += new Vector3(-0.05f, -0.035f, 0.06f) * (Mathf.Max(0f, a) / 50f) + new Vector3(0.015f, 0.03f, -0.02f) * (Mathf.Max(0f, -a) / 26f);
|
||||
rot = Quaternion.AngleAxis(a, Vector3.right) * rot;
|
||||
pos += new Vector3(0f, -0.04f, 0.06f) * (Mathf.Max(0f, a) / 50f) + new Vector3(0f, 0.03f, -0.03f) * (Mathf.Max(0f, -a) / 26f);
|
||||
}
|
||||
|
||||
// a new tool comes up from below with a turn of the wrist, and settles with a little overshoot
|
||||
@ -275,7 +301,7 @@ namespace GrassCutter
|
||||
float away = Mathf.Max(low, _hide);
|
||||
pos += new Vector3(0.04f * low, -0.35f * away, 0f);
|
||||
rot = Quaternion.Euler(25f * away, -10f * low, -35f * low) * rot;
|
||||
rig.root.localPosition = pos;
|
||||
rig.root.localPosition = pos + Shift;
|
||||
rig.root.localRotation = rot;
|
||||
rig.root.gameObject.SetActive(_hide < 0.99f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user