Fix: StagingAmbiance must never drive a rig-owned camera (zoom/shake regression)
Self-inflicted, found by the operator the moment they pressed Play: "the camera
is so far zoomed in and shaking".
StagingAmbiance rides Env_SeabedKit.prefab, which Game.unity instantiates as
well as ArtStaging — a placement that predates this session and was harmless
while the component only pulsed flora. The camera lissajous drift added in
b407f7cd6 then wrote _cam.position every LateUpdate against
PrototypeCameraRig's follow, pinning the camera to the authored _camBase
(0, 1, -10) while the rig lerped toward its desired (2.50, 16.72, -9.01).
Measured before: camera y oscillating 1.157 <-> 13.559, max 7.43 units per tick.
Measured after: y settles 16.658..16.709 (target 16.72), span 0.051, max step
0.004 — a ~1800x reduction in per-tick jitter.
Gate on the presence of PrototypeCameraRig, not on a scene name (scene-name
checks are banned by CLAUDE.md). Verified both directions: ArtStaging has no rig
so its drift still runs; Game.unity has one so the drift is correctly inert.
Note for next time: two `refresh_unity scope=scripts` calls reported
compile_requested=false and the editor kept running the STALE assembly, so the
first verification pass showed the guard "not working" when it simply was not
loaded. scope=all mode=force was required. Confirm a behavioural fix by probing
runtime state (_cam == null), not by re-reading the source.
304/304 EditMode green.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,10 +68,17 @@ namespace ProjectM.Client
|
||||
|
||||
void OnEnable() => CacheCamera();
|
||||
|
||||
/// <summary>
|
||||
/// NEVER drive a camera that a real rig owns. This component rides Env_SeabedKit.prefab, which Game.unity
|
||||
/// instantiates as well as ArtStaging — so on 2026-08-07 the drift below wrote _cam.position every
|
||||
/// LateUpdate against PrototypeCameraRig's follow, slamming the camera from its intended y~15.7 back to
|
||||
/// the authored y~1.5 each frame. Live symptom: "so far zoomed in and shaking" (measured: y oscillating
|
||||
/// 1.16 ↔ 13.56, 7.4 units per tick). Gate on the RIG, not on a scene name — scene-name checks are banned.
|
||||
/// </summary>
|
||||
void CacheCamera()
|
||||
{
|
||||
var cam = Camera.main != null ? Camera.main : Object.FindFirstObjectByType<Camera>();
|
||||
if (cam == null) return;
|
||||
if (cam == null || cam.GetComponent<PrototypeCameraRig>() != null) { _cam = null; return; }
|
||||
if (_cam != cam.transform) { _cam = cam.transform; _camBase = _cam.position; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user