On-screen look stick for first person - #81
Open
hernan0078 wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
1STis driving.It reuses your stick code rather than adding a parallel path. The touch stick writes into the same
sticktablegamepadaxiswrites 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
1STrung 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 / FASTINVERT YTwo design notes:
The preferences apply in a
steer()layer around the three device inputs rather than insidelookBy. I put them inlookByfirst 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.ModSettinggains an optionaldefaultindex.LOOK SPEEDreads 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
pushBattlefailure that predates this branch.