Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebXR: Set isPresenting flag before dispatching sessionstart event #18350

Closed
1 task done
KabirSheemul opened this issue Jan 9, 2020 · 2 comments · Fixed by #18375
Closed
1 task done

WebXR: Set isPresenting flag before dispatching sessionstart event #18350

KabirSheemul opened this issue Jan 9, 2020 · 2 comments · Fixed by #18375

Comments

@KabirSheemul
Copy link

Description of the problem

While starting an XR session, sessionstart event is dispatched from WebXRManager.js after a successful XR session has been established. After that, the isPresenting flag is set to true. As a result when we add an event listener for sessionstart, in the callback function isPresenting is returning false.

function onRequestReferenceSpace( value ) {
    referenceSpace = value;
    animation.setContext( session );
    animation.start();
    scope.dispatchEvent( { type: 'sessionstart' } );
    scope.isPresenting = true;
}

Is this behavior intentional? I think we should set the flag true before dispatching the event.

Three.js version
  • r112
@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 9, 2020

If the order is changed, it's also necessary to switch the order when sessionend is fired. Meaning isPresenting should be set to false first and then sessionend is dispachted.

@timothyallan
Copy link

If the order is changed, it's also necessary to switch the order when sessionend is fired.
Meaning isPresenting should be set to false first and then sessionend is dispachted.

This would solve some hacks I'm currently doing. In particular, I currently have to do a timeout hack on sessionend to get around this. My canvas needs to be resized after the session is ended, but I can't resize it as presenting is true still on sessionend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants