Skip to content

iOS: gyro aiming, and quick load on a long press of quick save - #24

Merged
kanapitsas merged 2 commits into
mainfrom
feat/hl2-gyro-quickload
Nov 8, 2026
Merged

kanapitsas merged 2 commits into
mainfrom
feat/hl2-gyro-quickload

Conversation

@kanapitsas

Copy link
Copy Markdown
Owner

Two touch-control additions for the iPhone, mainly for Half-Life 2.

Gyro aiming (runtime/ios/gyro_aim.c, CoreMotion in touch_controls.m)

  • Turning the phone turns the camera, on top of the touch stick or trackpad: thumb for large turns, wrists to aim.
  • Yaw follows the real vertical (works however the phone is tilted), pitch the screen's horizontal axis. Rotations under 0.05 rad/s are damped so a still phone does not drift.
  • On by default in Half-Life 2, off in Portal 2 (each back tap would shake the camera). Settings: "Gyro aiming" and "Gyro speed" (×0.5 to ×2); P2_GYRO, P2_GYRO_SPEED, P2_GYRO_TIGHTEN.
  • Sensors stop after 2 s outside play, at once when the app is left. Each sensor run has its own generation, so a sample still queued after a stop is dropped.

Quick load

  • Holding quick save for half a second sends F9 (HL2's default "load quick") with a vibration; a short press still saves (F6). Keys are held 50 ms and two frames, like back taps. A cancelled touch or a menu opening mid-press does not save.

Tested: make check (165 Python tests, 245 C checks; new checks_gyro_aim.c covers both landscapes, the real-vertical yaw, damping and gaps), HL2 played on an iPhone 15 Pro Max: gyro aiming and quick load work. Reviewed by Codex (three findings, fixed). Not tested: Portal 2 with gyro aiming turned on.

🤖 Generated with Claude Code

kanapitsas and others added 2 commits November 8, 2026 12:26
Yaw around the real vertical, pitch around the screen's horizontal axis,
small rotations damped. On by default for Half-Life 2 only: in Portal 2 each
back tap would shake the camera.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gyro motion is added to the touch camera; sensors stop outside play like
the back-tap ones. Holding quick save for half a second sends F9 (load
quick) instead of F6, so dying in HL2 no longer means Escape > Load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kanapitsas
kanapitsas merged commit 8f5788c into main Nov 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant