Hi there,
I have found a bug with setCamera(). https://www.babylonjs-playground.com/#14KRGG#174
In this playground , you will see that if I setTarget before the creation of the VrExperienceHelper, it’s working, but if I build the VrExperienceHelper before the function setCamera it’s not working.
I hope you will be able to fix that issue, because I would like to use the function setTarget many times and after the VrExperienceHelper
Hi guys. What’s happening… is that createDefaultVRExperience is changing scene.activeCamera. It becomes a deviceOrientationCamera… and MAYBE devO cams have a .target… but I’m not sure. Either way… Mathieu would need to use scene.activeCamera.setTarget() or similar.
https://www.babylonjs-playground.com/#11GAIH#67
(At console, you can see the devO cam get installed in scene.activeCamera. I force it back to being mattcamm, and then stuff starts working.)
In docs - options… it states… createDeviceOrientationCamera(default: true): If the non-WebVR camera should be created. To use an existing camera, create it and then initialize the helper with this set to false in the constructor.
So… Mathieu needs to use: var vrHelper = scene.createDefaultVRExperience({createDeviceOrientationCamera: false});
Now we have good target-setting, because mattcamm stays installed as scene.activeCamera. No bug.
We COULD add an example of using constructor options… just below Options section of docs.
Possibly… a console warning could be issued… from .setTarget method… IF user calls setTarget() on a cam that is not currently === scene.activeCamera. Just thinkin’. That might be a bad idea, though… as user/progger SHOULD freely be allowed to set targets on inactive cameras.