Skip to content

Decide what to do with Gamepad.index #583

@toji

Description

@toji

One issue that we currently have with input sources is that if we have two controllers of the same type without different handedness (think Vive controllers prior to handedness estimation) and then one of them disconnects we have no way of indicating which one it was outside of tracking the pose frame to frame and trying to identify which one the remaining controller is closest to, which... 🤢

The Gamepad API addresses this by leaving holes in the gamepads array, so that a single controller remains in the same index for the lifetime of it's connection. Developers are opinionated about this approach.

I would propose instead that we should use the Gamepad.index attribute to uniquely identify devices within a session. The value should be something that monotonically increases with each newly connected device and doesn't actually correspond to the element index in the array at all, which allows us to avoid array gaps. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed by pending PRA PR that is in review will resolve this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions