Skip to content

On-screen look stick for first person - #81

Open
hernan0078 wants to merge 1 commit into
DramaticShape:masterfrom
hernan0078:look-stick
Open

On-screen look stick for first person#81
hernan0078 wants to merge 1 commit into
DramaticShape:masterfrom
hernan0078:look-stick

Conversation

@hernan0078

Copy link
Copy Markdown

First person on a phone has the d-pad for walking and drag-anywhere for looking — but nothing on screen says the second one exists. A player who does not already know to drag cannot turn around.

This adds a thumbstick above A/B, drawn only while 1ST is driving.

It reuses your stick code rather than adding a parallel path. The touch stick writes into the same stick table gamepadaxis writes to, so it gets the rate-based response you already implemented: a held deflection keeps turning, with the squared curve. A drag-based stick would stop turning when the thumb hit the rim, which is the usual mistake. It centres on release.

Drag-anywhere is untouched underneath — the stick is an affordance for the thumb already over there, not a replacement for a flick with a spare finger.

Three rows come with it, gated to the 1ST rung so they are invisible everywhere else:

  • LOOK STICK — hide it for controller players. Hiding also stops it claiming touches, or it would be an invisible control eating thumbs.
  • LOOK SPEED — SLOW / NORMAL / FAST
  • INVERT Y

Two design notes:

The preferences apply in a steer() layer around the three device inputs rather than inside lookBy. I put them in lookBy first and it broke your test asserting a 2π turn wraps to zero — correctly, since that is the primitive the rig drives and one full turn must stay one full turn whatever the sensitivity is set to.

ModSetting gains an optional default index. LOOK SPEED reads SLOW/NORMAL/FAST in that order but should start at NORMAL, and rung 1 was the only default available. Existing calls are unaffected.

Tested on a physical iPhone 17 Pro, and run against the engine test suite in my own tree, where the mod tier passes apart from a pushBattle failure that predates this branch.

First person on a touch device has the d-pad for walking and a drag-anywhere
gesture for looking, and no visible affordance for the second one -- a player
who does not already know to drag has no way to turn around.

Adds a thumbstick above A/B, drawn only while 1ST is driving. It writes into
the same stick table the physical right stick writes to, so it inherits the
rate-based response already implemented for a gamepad: a held deflection
keeps turning, with the squared curve, rather than running out of travel at
the edge of the glass the way a drag does. It centres on release.

Drag-anywhere is untouched underneath: the stick is an affordance for the
thumb that is already over there, not a replacement for a flick with whatever
finger is free.

Three rows come with it, gated to the 1ST rung so they are invisible
elsewhere: LOOK STICK hides it for controller players (and stops it claiming
touches, or it would be an invisible control), LOOK SPEED, and INVERT Y.

The preferences apply in a steer() layer wrapping the three device inputs
rather than inside lookBy, so the mouse, the stick and a drag stay in step
while lookBy remains the exact primitive the rig and the tests drive -- a
2*pi turn has to stay one turn whatever the sensitivity.

ModSetting gains an optional default index, because LOOK SPEED reads
SLOW/NORMAL/FAST in that order but should start at NORMAL, and rung 1 was the
only default available.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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