Jump to content

Highlighter not working in VR


brianzinn
 Share

Recommended Posts

@DeltakoshThe bug is related to specifying a VR camera in highlighter options.
https://www.babylonjs-playground.com/#1KUJ0A#84

If I comment out line 39 (camera option) then the highlighter works as expected.  Additionally, if I am using a regular FreeCamera then it also works as expected.

I think the issue is here (and on line 430):

https://github.com/BabylonJS/Babylon.js/blob/2c0fa2446981bfb173cb7dca0fd76891e1b6e9be/src/Materials/Textures/babylon.renderTargetTexture.ts#L356

The cameras are the "same" camera, but not seen as the "same".  Their ids are: "WebVRCamera_L" and "WebVRCamera".

This code will fix the left camera to be working, but not right.

if (this.activeCamera !== scene.activeCamera &&
    (this.activeCamera.leftCamera && this.activeCamera.leftCamera !== scene.activeCamera)) {
    scene.setTransformMatrix(
        this.activeCamera.getViewMatrix(), 
        this.activeCamera.getProjectionMatrix(true)
    );
}

I think though, a better check would involve checking RigMode and a way on the camera classes themselves to determine equality. So, maybe better for someone more familiar with this code? I'm probably going to switch my highlighter code to GUI anyway, but wanted to share the cause + resolution.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...