bot: fix slow/unsteerable driving + controls tooltip
Diagnosis (agent + live values): tuning & tread geometry were fine, debugAutoDrive off — the real drag was the box chassis sliding on default ~0.6 friction, which ate forward speed AND resisted yaw (dead steering). - Bot_LowFriction physics material (0.3, Minimum combine) on the chassis → slides + yaws freely. - TreadPart yaw-assist (220 N·m, sign reinforces natural differential) so a throttle difference gives a clear turn; cancels to zero on equal throttle (straight kept). - SeatManager: context-aware controls tooltip under the seat box (on-foot vs driving), with a 'turn: differ vs teammate' hint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
30d0b27813
commit
93b8fae66b
5 changed files with 58 additions and 4 deletions
|
|
@ -179,6 +179,20 @@ namespace Jankenbots.Prototype
|
|||
{
|
||||
ReleaseSeatRpc();
|
||||
}
|
||||
|
||||
// Controls hint under the seat box — context-aware (on foot vs driving).
|
||||
int ty = y + h + 6, th = 54;
|
||||
GUI.Box(new Rect(x, ty, w, th), "Controls");
|
||||
if (mine.HasValue)
|
||||
{
|
||||
GUI.Label(new Rect(x + 10, ty + 20, w - 20, 18), "W throttle · LShift pivot · A/D lean");
|
||||
GUI.Label(new Rect(x + 10, ty + 34, w - 20, 18), "Q leave · V camera · turn: differ vs teammate");
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(new Rect(x + 10, ty + 20, w - 20, 18), "WASD move · Mouse look · Scroll zoom");
|
||||
GUI.Label(new Rect(x + 10, ty + 34, w - 20, 18), "E claim tread · V camera · Esc free cursor");
|
||||
}
|
||||
}
|
||||
|
||||
static string SeatLabel(ulong pilot) => pilot == NoPilot ? "free" : $"#{pilot}";
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ namespace Jankenbots.Prototype
|
|||
[Range(0f, 0.5f)]
|
||||
public float throttleDeadzone = 0.08f;
|
||||
|
||||
[Tooltip("Extra yaw torque (N·m) at full throttle, REINFORCING the natural differential turn so steering reads clearly even with ground friction. Left/Right push opposite ways, so equal throttle cancels to zero → straight line preserved. Set 0 to rely on pure emergent differential. Flip sign in code if it ever fights the turn.")]
|
||||
public float yawAssistTorque = 220f;
|
||||
|
||||
// ---- (b) LOCK-PIVOT tuning -----------------------------------------------
|
||||
[Header("(b) Lock-pivot — plant this tread as an anchor")]
|
||||
[Tooltip("How hard the planted tread resists the chassis sliding at its position.")]
|
||||
|
|
@ -192,6 +195,13 @@ namespace Jankenbots.Prototype
|
|||
{
|
||||
Vector3 drive = transform.forward * (_throttle * cruiseForce);
|
||||
chassis.AddForceAtPosition(drive, treadPos, ForceMode.Force);
|
||||
|
||||
// Yaw assist: reinforce the differential turn (Left throttles → nose right,
|
||||
// Right throttles → nose left). Cancels to zero when both throttle equally,
|
||||
// so straight-line driving is untouched; the maxAngularVelocity clamp still
|
||||
// caps total spin so this can't reintroduce an uncontrolled tip.
|
||||
float yawSign = side == Side.Left ? 1f : -1f;
|
||||
chassis.AddTorque(chassis.transform.up * (yawSign * _throttle * yawAssistTorque), ForceMode.Force);
|
||||
}
|
||||
|
||||
// ---- (c) PASSIVE LEAN — anti-tip ballast ---------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue