Skip to content

Fix reversed analog-stick Y-axis on iOS controllers - #512

Merged
Kief5555 merged 1 commit into
OpenCloudGaming:kief5555/iosfrom
n-elnouby:patch-1
Jun 17, 2026
Merged

Fix reversed analog-stick Y-axis on iOS controllers#512
Kief5555 merged 1 commit into
OpenCloudGaming:kief5555/iosfrom
n-elnouby:patch-1

Conversation

@n-elnouby

Copy link
Copy Markdown
Contributor

The native GameController bridge in StreamerView.payload(for:) forwarded raw thumbstick Y values to the embedded streamer JS. Apple's GameController framework reports Y as up = +1, but the streamer JS (normalizeGamepadAxis(-(axes[1]))) expects the W3C browser convention (up = -1) and negates Y itself — so the value was double-inverted, reversing Y on both sticks.

Negating Y in the Swift bridge converts to the browser convention at the source, so up/down match again. Verified on a device build: both sticks now correct.

Description

The native GameController bridge in StreamerView.payload(for:) forwarded raw
thumbstick Y values to the embedded streamer JS. Apple's GameController
framework reports Y as up = +1, but the streamer JS (normalizeGamepadAxis(-(axes[1])))
expects the W3C browser convention (up = -1) and negates Y itself — so the value
was double-inverted, reversing Y on both sticks.

Negating Y in the Swift bridge converts to the browser convention at the source,
so up/down match again. Verified on a device build: both sticks now correct.
@n-elnouby n-elnouby closed this Jun 12, 2026
@n-elnouby n-elnouby reopened this Jun 12, 2026
@Kief5555

Copy link
Copy Markdown
Collaborator

Hi @n-elnouby, thank you for the PR! Please provide a video demonstrating this fix.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes inverted vertical (Y) thumbstick input for iOS GameController-based controllers by aligning the native Swift bridge’s axis sign convention with the W3C browser Gamepad convention expected by the embedded streamer JavaScript.

Changes:

  • Negate leftThumbstick.yAxis.value and rightThumbstick.yAxis.value in the native controller payload to convert iOS “up = +1” into browser “up = -1”.
  • Preserve existing clamping and payload shape so the embedded JS mapping continues to work as-is.

@Kief5555

Copy link
Copy Markdown
Collaborator

Actually, LGTM. Thank you for the PR!

@Kief5555
Kief5555 merged commit df17c1b into OpenCloudGaming:kief5555/ios Jun 17, 2026
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.

3 participants