Wagons on the rails, buildings on the slope, an autopilot nothing stops

- The train's loco and wagons stand on their front and back axles, so they pitch with the track up and down hills
  instead of standing level and hanging off one end; wheels sit on the rail tops, gauge matched to the models.
- A piece set down on the soil leans with the ground under its footprint (up to 22 degrees) and sinks until no
  corner hangs in the air; foundations stay level.
- On autopilot a machine touches nothing: it rides on the soil and the base deck and drives straight through
  buildings, rocks, rails, people and machines. Wedged anyway, it hops a few metres on; it no longer gives up on
  the way to unload.
- -demoauto puts a building in the way to the yard, sets one down on the steepest clear slope and reports any tip-over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiemandKG
2026-11-10 19:54:01 +06:00
parent 6b2a9931b9
commit 0db89bf7cb
5 changed files with 186 additions and 31 deletions

View File

@ -278,7 +278,7 @@ namespace GrassCutter
void FixedUpdate()
{
if (!IsSpawned || !IsOwner || Body.isKinematic) return;
if (!IsSpawned || !IsOwner || Body.isKinematic) { if (_ghost) Ghost(false); return; }
bool driving = LocalDriving;
var input = driving ? Ctl.Move : Vector2.zero;
// the host drives a machine on autopilot
@ -295,6 +295,8 @@ namespace GrassCutter
var up = Planet.Up(transform.position);
Body.AddForce(-up * GameDefs.LowGravity, ForceMode.Acceleration);
// on autopilot nothing stops it: it drives through buildings, rocks, props, people and machines, on the soil
Ghost(auto);
// raycast springs at four corners (soil, deck, ramp)
int wet = 0;
@ -306,7 +308,8 @@ namespace GrassCutter
var local = new Vector3(Probes[i].x * width, 0f, Probes[i].y * length);
var wp = transform.TransformPoint(local);
float clearance = Planet.Altitude(wp);
if (Physics.Raycast(wp + up * 1.2f, -up, out var sh, 1.2f + ride + 1.5f, groundMask, QueryTriggerInteraction.Ignore))
if (auto) clearance = Mathf.Min(clearance, DeckClearance(wp, up, 1.2f + ride + 1.5f));
else if (Physics.Raycast(wp + up * 1.2f, -up, out var sh, 1.2f + ride + 1.5f, groundMask, QueryTriggerInteraction.Ignore))
clearance = Mathf.Min(clearance, sh.distance - 1.2f);
float depth = ride - clearance;
if (depth > 0f)