Files
chameleon/Assets/Scenes
adminandClaude Opus 4.8 120d3b6675 Fix wall/ceiling corner rotation twitch by latching the climbed surface
In an inner wall/ceiling corner the body's facing flipped ~9 deg every
frame. Recorded frame data showed the wall/ceiling classification flipping
160 times: _wallNormal.y swung the full range (0.0 wall <-> -0.966 ceiling)
each frame, far past the hysteresis band, so the Schmitt trigger could not
hold it.

Root cause: _wallNormal had two competing per-frame sources.
- The contact-normal blend (Update) mixes ceiling and wall contacts in the
  corner into ~(0,-0.97,-0.26), classified as ceiling.
- ProbeWall raycasts along -_wallNormal, which tilts toward the wall, so the
  ray clips the wall and returns (0,0,-1), classified as wall.
Wall and ceiling drive different rotation targets (snap to face-wall vs.
face movement direction), producing the per-frame twitch.

Fix:
- The contact blend no longer overwrites _wallNormal during an active climb
  (it only seeds the initial grab); the probes own the normal while climbing.
- Surface-aware probing: on a ceiling, probe straight up (ProbeCeiling)
  instead of along -_wallNormal, so the angled ray can no longer clip the
  wall and demote us. Stay latched on the ceiling until it is genuinely gone
  overhead, then fall back to the wall probe.

Also retains the ceiling-class hysteresis (Schmitt trigger on the normal's
downward tilt) from the prior attempt as added stability.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 10:25:05 +02:00
..