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

fix(webxr): remove controllers rays when stopping XR #3220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

munozco
Copy link

@munozco munozco commented Feb 18, 2025

Context

When using vtkWebXRRenderWindowHelper with drawControllersRay=true, rays are drawn to represent the controllers
but they are not removed when stopping the XR session. This leads to the camera not being centered correctly.

Here's a comparison of before starting the XR session and after stopping it:
before
after

Results

Thanks to this small fix, the rays' actors are removed when exiting the XR session, and the camera can be re-centered

Changes

When vtkWebXRRenderWindowHelper.stopXR() is called, every ray's actor is removed so they are not visible anymore.

  • Documentation and TypeScript definitions were updated to match those changes
    • No changes in definitions

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • Tested environment:
    • vtk.js: latest master (413f07a)
    • OS: Windows 11 WSL2 Debian 12
    • Browser: Chromium 133.0.6943.98

@munozco munozco marked this pull request as ready for review February 19, 2025 14:32
@munozco
Copy link
Author

munozco commented Feb 20, 2025

@bourdaisj @finetjul please review

Copy link
Member

@finetjul finetjul left a comment

Choose a reason for hiding this comment

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

LGTM

const ren = model.renderWindow.getRenderable().getRenderers()[0];
model.xrSession.inputSources.forEach((inputSource) => {
if (model.inputSourceToRay[inputSource.handedness]) {
ren.removeActor(model.inputSourceToRay[inputSource.handedness].actor);
Copy link
Contributor

Choose a reason for hiding this comment

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

why not destroying the pipeline instead of only removing/hiding actor?

@floryst
Copy link
Collaborator

floryst commented Feb 20, 2025

I think this was mistakenly closed from the other issue. Re-opening.

@floryst floryst reopened this Feb 20, 2025
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.

4 participants