Docs: reduce over-documentation across gameplay scripts

Trim restated narration, dead commented-out code, and oversized class
headers; keep all why-comments (authority, timing, edge cases), tooltips,
and serialization caveats.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Fable 5 committed 2026-07-02 10:08:28 +02:00
1 parent 882d30797e
commit 066e308cde
21 files changed
+478 -902

No files matched your search

+20 -32
View File
@@ -139,12 +139,10 @@ public class ThirdPersonOrbitInput : MonoBehaviour
void OnDisable()
{
InputUtil.SetCursorLocked(false);
// Deliberately DON'T zero the pan here. The only thing that disables this component is FreeCamMode
// taking over, and the freecam snaps to the live (still panned) view. Resetting the offset now would
// jump the orbit camera the brain blends FROM to center while the freecam sits at the panned pose -
// the visible "snap to 0, then translate to the offset" on the paint->freecam switch. Leaving the
// offset frozen keeps blend-from == blend-to (both panned) -> a seamless handoff. The pan then glides
// home on its own once the orbit input runs again in a non-paint mode (PanEnabled false).
// Deliberately DON'T zero the pan: only FreeCamMode disables this component, and the freecam
// snaps to the live (still panned) view - resetting now would jump the blend-FROM camera to
// center while the freecam sits at the panned pose (the visible snap on the paint->freecam
// switch). Frozen offset = blend-from == blend-to; the pan glides home once the orbit runs again.
}
/// <summary>Uniform scale of the current follow target (1 when none, or when Scale With Target is off).
@@ -157,13 +155,10 @@ public class ThirdPersonOrbitInput : MonoBehaviour
return t ? Mathf.Max(0.0001f, t.lossyScale.x) : 1f;
}
/// <summary>How much the pan SENSITIVITY scales with the live zoom distance. Dividing the orbit radius by the
/// default radius makes this exactly 1 at the default zoom (so the authored panSensitivity keeps its feel
/// there), smaller when zoomed in (finer pan) and larger when zoomed out. The body scale cancels out because
/// the radius already embeds it - a bigger player orbits proportionally farther - so the pan stays
/// body-relative across player sizes at every zoom. The result: the model slides the same amount ON SCREEN
/// per pixel regardless of how far the wheel has zoomed. The clamp does NOT use this - panMaxDistance is
/// body-relative only (CurrentScale), so the world-space pan limit is constant across zoom levels.</summary>
/// <summary>Pan-SENSITIVITY scale with the live zoom: radius / defaultRadius = 1 at the default zoom,
/// finer zoomed in, coarser zoomed out - the model slides the same amount ON SCREEN per pixel at any
/// zoom. Body scale cancels out (the radius already embeds it). The clamp deliberately does NOT use
/// this: panMaxDistance stays body-relative only, constant across zoom levels.</summary>
float PanZoomScale() => _orbit ? _orbit.Radius / Mathf.Max(0.0001f, defaultRadius) : 1f;
/// <summary>Snaps the zoom to the scaled default radius. Called when a new avatar binds (see
@@ -177,13 +172,11 @@ public class ThirdPersonOrbitInput : MonoBehaviour
_zoomInit = true;
}
/// <summary>Snaps the orbit axes so the camera faces along Camera.main's current view direction, so the
/// next orbit mode keeps that facing instead of restoring the orbit's last-used angle. Called when
/// switching out of a non-orbit rig (first person): Camera.main still shows that rig's view this frame
/// (the brain hasn't blended yet), so the read is exact. With WorldSpace binding + Sphere orbit + a
/// centered composer the camera look rotation is exactly Euler(VerticalAxis, HorizontalAxis, 0), so
/// HorizontalAxis = world yaw and VerticalAxis = world pitch (positive = looking down). No-op without a
/// live camera/orbit.</summary>
/// <summary>Snaps the orbit axes to Camera.main's current view direction so the next orbit mode keeps
/// that facing instead of the orbit's last-used angle. Called when switching out of a non-orbit rig:
/// Camera.main still shows that rig's view this frame (the brain hasn't blended yet), so the read is
/// exact. With WorldSpace binding + Sphere orbit + a centered composer the look rotation is exactly
/// Euler(VerticalAxis, HorizontalAxis, 0).</summary>
public void SyncToView()
{
if (!_orbit) return;
@@ -250,9 +243,8 @@ public class ThirdPersonOrbitInput : MonoBehaviour
float scroll = (InputUtil.ShiftHeld() || InputUtil.CtrlHeld()) ? 0f : InputUtil.ReadScroll();
if (!Mathf.Approximately(scroll, 0f))
{
// One wheel notch = one zoom step (sign only), independent of the platform's raw wheel
// magnitude. Scrolling up zooms in. Step scales with the player so the number of notches to
// cross the range is the same at every size.
// One wheel notch = one zoom step (sign only, platform-independent). The step scales with
// the player so the notch count to cross the range is the same at every size.
_targetRadius -= Mathf.Sign(scroll) * zoomSpeed * scale;
}
@@ -308,11 +300,9 @@ public class ThirdPersonOrbitInput : MonoBehaviour
axis.Value = value;
}
/// <summary>Middle-mouse pan: while PaintMode enables it, holding the middle button and dragging slides the
/// whole framing along the screen right/up axes (via the camera-offset extension), then eases the offset
/// back to center on release. A temporary framing offset to line up an awkward spot of the model for
/// painting - the player body and its paint collider are untouched. Disabled (eases home) outside paint mode
/// and while the orbit is parked in <see cref="OrbitLookMode.Disabled"/> (pause / no-player).</summary>
/// <summary>Middle-mouse pan (while PaintMode enables it): slides the whole framing along the screen
/// right/up axes via the camera-offset extension - a temporary offset to line up an awkward spot of
/// the model for painting. Eases home outside paint mode / while the orbit is Disabled.</summary>
void UpdatePan(float dt)
{
if (!enablePan || !_camOffset)
@@ -324,10 +314,8 @@ public class ThirdPersonOrbitInput : MonoBehaviour
if (active && InputUtil.MiddleMouseHeld())
{
Vector2 d = InputUtil.ReadMouseDelta() * MouseSensitivity.Multiplier;
// Subtracting the drag gives a hand-tool feel (the model follows the cursor: drag right -> model
// slides right). The step scales with the orbit distance so it feels the same on screen at every
// zoom (finer when zoomed in). The clamp stays body-relative only (no zoom factor), so the maximum
// pan distance in world units is the same at every zoom level.
// Subtracting gives a hand-tool feel (the model follows the cursor). The step scales with the
// zoom (same on-screen feel, see PanZoomScale); the clamp stays body-relative only.
_pan -= d * (panSensitivity * zoom);
_pan = Vector2.ClampMagnitude(_pan, panMaxDistance * CurrentScale());
}