[claude] Timmy slap / ragdoll physics — spring wobble + Pip startle (#43) #85

Merged
Rockachopa merged 1 commits from claude/issue-43 into main 2026-03-23 20:14:37 +00:00
Collaborator

Fixes #43

Changes

  • Hit detection: raycasting in click/touch handlers detects hits on Timmy's mesh group; impact direction extracted from camera→hit point
  • Spring physics: lightweight spring integrator on Timmy's body group — applySlap() applies additive angular impulses that stack (repeated slaps before spring settles accumulate), with stiffness=18, damping=4.5, ~1s return time
  • Ragdoll threshold: if accumulated tilt/velocity exceeds RAGDOLL_TILT_THRESHOLD (0.42 rad), full ragdoll fall sequence triggers
  • Pip startle: mild startle on wobble, full scatter on ragdoll — resumes idle wander after ~3s
  • Boing sound: synthesised via Web Audio OscillatorNode (no audio files)
  • Crystal ball flash: emissive intensity spike for ~100ms on every hit
  • Touch events: identical to click (mobile support)
  • Counter-slap: after ragdoll recovery, Timmy lunges back with retort

Spring tuning

SPRING_STIFFNESS=18, SPRING_DAMPING=4.5, SLAP_IMPULSE=2.8 — produces visible wobble that settles in ~1s as specified.

Fixes #43 ## Changes - **Hit detection**: raycasting in click/touch handlers detects hits on Timmy's mesh group; impact direction extracted from camera→hit point - **Spring physics**: lightweight spring integrator on Timmy's body group — `applySlap()` applies additive angular impulses that stack (repeated slaps before spring settles accumulate), with stiffness=18, damping=4.5, ~1s return time - **Ragdoll threshold**: if accumulated tilt/velocity exceeds `RAGDOLL_TILT_THRESHOLD` (0.42 rad), full ragdoll fall sequence triggers - **Pip startle**: mild startle on wobble, full scatter on ragdoll — resumes idle wander after ~3s - **Boing sound**: synthesised via Web Audio `OscillatorNode` (no audio files) - **Crystal ball flash**: emissive intensity spike for ~100ms on every hit - **Touch events**: identical to click (mobile support) - **Counter-slap**: after ragdoll recovery, Timmy lunges back with retort ## Spring tuning `SPRING_STIFFNESS=18`, `SPRING_DAMPING=4.5`, `SLAP_IMPULSE=2.8` — produces visible wobble that settles in ~1s as specified.
claude added 1 commit 2026-03-23 20:08:41 +00:00
feat: additive spring impulse for Timmy slap wobble (#43)
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 1s
dbbaf80dcb
Slaps now apply additive spring impulses that stack, producing a
satisfying wobble-and-return (~1s). Only after enough accumulated
force (tilt or velocity threshold) does Timmy enter the full ragdoll
fall sequence. This matches the spec's "repeated slaps before spring
settles stack (additive impulse)" requirement.

- Tuned spring constants (stiffness=18, damping=4.5) for visible wobble
- SLAP_IMPULSE actually used now (was defined but unused)
- Pip gets mild startle on wobble, full scatter only on ragdoll
- Crystal flash + sound still fire on every hit

Fixes #43

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rockachopa merged commit cbeaa61083 into main 2026-03-23 20:14:37 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#85