From 1fc98bdcde533e80b51aeffc45bccd168c69ed9a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 10 Oct 2026 03:31:49 +0200 Subject: [PATCH] ThrustAllocator: write the error coefficients every call; no Array.Clear on A Every entry of A is now assigned each call or never written, so the clear was a second owner of the same state (hand mutants a-never-cleared and a-cleared-by-division survived it as equivalent). Co-Authored-By: Claude Opus 5.5 --- Assets/Scripts/ServerShared/ThrustAllocator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/ServerShared/ThrustAllocator.cs b/Assets/Scripts/ServerShared/ThrustAllocator.cs index f2be04f3e..200a2abcc 100644 --- a/Assets/Scripts/ServerShared/ThrustAllocator.cs +++ b/Assets/Scripts/ServerShared/ThrustAllocator.cs @@ -39,7 +39,6 @@ public sealed class ThrustAllocator var vars = n + ErrorVariables; var rows = FixedRows + n; - Array.Clear(_a, 0, rows * vars); // Rows 0 and 1 are the translation axes (starboard, forward), row 2 the yaw. for (var axis = 0; axis < 3; axis++) @@ -60,10 +59,11 @@ public sealed class ThrustAllocator var row = axis * vars; for (var i = 0; i < n; i++) _a[row + i] = Component(columns[i], axis) * scale; _b[axis] = demand * scale; - if (axis < 2 && extreme > 0) + if (axis < 2) { - _a[row + n + 2 * axis] = -weight; - _a[row + n + 2 * axis + 1] = weight; + var errorWeight = extreme > 0 ? weight : 0f; + _a[row + n + 2 * axis] = -errorWeight; + _a[row + n + 2 * axis + 1] = errorWeight; } }