Skip to content

Conversation

@Maksims
Copy link
Collaborator

@Maksims Maksims commented Apr 13, 2020

Allows XR (VR and AR) Input Sources to interact with Element components. This simplifies creating UI for XR.
Events: hoverstart, hoverend, pressedstart, pressedend, click will now be fired when interacting with UI using input sources: gaze, screen (AR), handheld, etc.

New APIs:

pc.ElementInput#options.useXr // new property for constructor options
entity.button.on('selectstart', function(evt) { }); // fired when input source primary action is started on UI element
entity.button.on('selectend', function(evt) { }); // fired when input source primary action is ended on UI element
entity.button.on('selectenter', function(evt) { }); // fired when input source starts to hover over UI element
entity.button.on('selectleave', function(evt) { }); // fired when input source is not hovering over UI element anymore
pc.ElementSelectEvent // new event object to handle input sources interactions with Elements
pc.XrInputSource#id // unique number to identify input source. It will not persist for physical hardware reconnections.
pc.XrInputSource#elementInput // boolean to toggle if input source should interact with Elements. By default is True.
pc.XrInputSource#elementEntity // null or Entity over which input source ray is hovering

I confirm I have signed the Contributor License Agreement.

@Maksims
Copy link
Collaborator Author

Maksims commented Apr 13, 2020

This PR will have to be updated after #1991 is merged.

@willeastcott
Copy link
Contributor

OK @Maksims, #1991 has now been merged. 😄

@willeastcott willeastcott added the area: xr XR related issue label Apr 15, 2020
@Maksims
Copy link
Collaborator Author

Maksims commented Apr 16, 2020

Updated the PR, so now it uses updated input source transform methods.
Ready for merging.

@willeastcott willeastcott merged commit 87b5c8e into playcanvas:master Apr 16, 2020
ellthompson pushed a commit to ellthompson/engine that referenced this pull request Apr 20, 2020
* XR input sources interact with Elements

* update input source ray

* add new input source property - which element it hovering

Co-authored-by: Will Eastcott <[email protected]>
@Maksims Maksims deleted the webxr-ui-input branch January 22, 2024 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: xr XR related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants