brianzinn Posted August 19, 2017 Share Posted August 19, 2017 Just trying out the new VR helper on an older phone to see what it would look like using Cardboard: http://www.babylonjs-playground.com/#IHY77X#16 Uncaught TypeError: Cannot read property 'rotationQuaternion' of null at t.set [as camera] (babylon.js:38) at i.t.detachElement (babylon.js:19) at i.t.clear (babylon.js:19) at i.dispose (babylon.js:20) at t.enterVR (babylon.js:39) at HTMLButtonElement.<anonymous> (babylon.js:39) I can look at it more later - that's the output from remote debugging console once I click on the glasses button. Is there a way to run playground under babylon-max? Otherwise I will need to update my current project with latest version, which would be good anyway! Thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 21, 2017 Share Posted August 21, 2017 Yes there is a way: https://playground.babylonjs.com/debug.html Please let us know if you can reproduce the issue Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 23, 2017 Author Share Posted August 23, 2017 Thanks for the debug link. I can reproduce quite easy. Communicating my debug experience presents more of a challenge. in the enterVR function my active Camera is a DeviceOrientationCamera and is working with phone movements. There is a loop in CameraInputsManager.prototype.detachElement: for (var cam in this.attached) { var input = this.attached[cam]; this.attached[cam].detachControl(element); if (disconnect) { this.attached[cam].camera = null; } } The loop works with "keyboard" and "mouse". The third item in the attached array is "deviceOrientation" and the input is a FreeCameraDeviceOrientationInput. Object.defineProperty(FreeCameraDeviceOrientationInput.prototype, "camera", { get: function () { return this._camera; }, set: function (camera) { this._camera = camera; if (!this._camera.rotationQuaternion) this._camera.rotationQuaternion = new BABYLON.Quaternion(); }, enumerable: true, configurable: true }); As you can see in the loop the camera is being set to NULL. The set function will be passed NULL, so this._camera will be null and this._camera.rotationQuaternion throws an exception. https://github.com/BabylonJS/Babylon.js/blob/deefbcdbae137661f3ba4472ed3f7c54940b0337/src/Cameras/Inputs/babylon.freeCameraDeviceOrientationInput.ts#L23 I think the other camera properties in the loop are member variables as I couldn't step into them. I would say there should be a guard statement in the setter. ie: public set camera(camera: FreeCamera) { this._camera = camera; if (this._camera != null && !this._camera.rotationQuaternion) this._camera.rotationQuaternion = new Quaternion(); } Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 23, 2017 Share Posted August 23, 2017 Completely agree. Do you mind to submit a PR? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted August 24, 2017 Author Share Posted August 24, 2017 I will submit one in next few days. Need to setup environment to test first. Cheers. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.