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

Refactor WebXr with support of vr controllers #2500

Open
wants to merge 98 commits into
base: master
Choose a base branch
from

Conversation

AnthonyGlt
Copy link
Contributor

@AnthonyGlt AnthonyGlt commented Feb 13, 2025

Description

Refactoring of the VR. Following the work done previously and here.

Handling the controllers correctly. To do so, I've created vrHeadSet which is containing a clone of the camera (_camXR). The vrHeadSet will be used to translate the webxr scene around the globe. This is to bypass this bug which cause imprecision.
Then at each animation, I use the _camXR to update the position of our cam.
I can't directly use our default cam, because the camera needs a parent and it's position will also be affected by the position of the VR scene, which is usually set using this way:

const transform = new XRRigidTransform(offsetPosition, offsetRotation);
const teleportSpaceOffset = this.baseReferenceSpace.getOffsetReferenceSpace(transform);
this.parentRenderer.xr.setReferenceSpace(teleportSpaceOffset);

I also had to create callbacks in src/Layer/OGC3DTilesLayer.js to update the 3dtiles while being in VR.
Related issue

To activate the VR, we have to pass the webXR argument in the view option. To activate the controllers, we have to pass the argument controllers to true as follows:

{ webXR: { controllers: true } }

Motivation and Context

Update the VR and get a better controllers support

Screenshots (if appropriate)

image

Screencast.from.13-02-2025.14.25.53.webm

##TODO

  • handle xr session end
  • define webxr only in globelayer
  • add more functionnalities (teleportation)
  • better handling of the 3dtiles update/ view update

@AnthonyGlt
Copy link
Contributor Author

@Desplandis
We could see about the animation process (especially for the 3Dtiles) since you're also working on the topic for #2428

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.

2 participants