Looking Glass support

Wondering if anyone has been able to work with a Looking Glass hologram display with there projects yet? Not seeing any discussion but followed a tutorial online provided by Looking Glass. Followed all the steps but when I press the button, I get this error

[Main.js?id=211411551&branchId=5cd22dd1-4bf5-4196-b448-a318ec5d2f79:49]: Uncaught TypeError: Cannot read properties of null (reading ‘camera’)

TypeError: Cannot read properties of null (reading ‘camera’)
at HTMLButtonElement. (https://launch.playcanvas.com/api/assets/files/scripts/LookingGlass/Main.js?id=211411551&branchId=5cd22dd1-4bf5-4196-b448-a318ec5d2f79:49:31)

Its only two scripts, I tried intergrating into a current project as well as the template they appeared to use for the tutorial but same error. Appreciate any suggestions., thanks.

it seems like you have not assigned cameraEntity into your script somewhere.

Hi @BeardsAndBacon !

It looks like your Main.js script is what’s specifically missing the cameraEntity attribute. In looking at your project, it seems like the script was never parsed/ You’ll want to click this button on the script:

image

and then on the entity that has main.js added to it, drag and drop the camera entity that the script should be acting on.

I hope this is helpful!

1 Like

Great advice, I was wondering why I wasn’t getting the dialog to attach my camera. I was never quite sure what that button did but after reading up on this forum and these tips, I now understand a bit better and will parse scripts more often.

One Step forward. Unfortunately, one more error popped up. The button didn’t appear to be working as nothing would happen when clicking. Tried it in two seperate projects with the same InvalidState Error - gl.makeXRCompatible();

This feels like maybe it was once compatible but is no longer?

Sorry for the late reply! I’m not super familiar with the XR capabilities of Playcanvas, but I did find this related thread from a year ago:

It seems like the setup proposed there is a bit different, as they’re accessing this.app.graphicsDevice.gl directly as opposed to grabbing the canvas.