Hello,
I’m running a project from editor into Oculus Quest 2 and, when in VR mode, I’m drawing, in the update, a coloured line straight from the controller tip to show where user is pointing at.
In the first scene everything works well and I have a single line following the controller.
As soon as I change the scene the line from the controller still works but I can also see every line drawn in previous frames as they persists in the scene.
This happens whether the scene changes before or after VR session start.
This is the snippet I use to add a controller to the scene:
this.app.xr.input.on('add', function (inputSource) {
....
}, this);
Ok thanks for the answer. Adding world layer to the drawLine call does not solve the problem but I will setup a blank project and give you the link asap.
I wonder if this is due to scene switching since I don’t load a different scene but the same scene with different dynamically placed objects by destroying everything like this
this.app.xr.input.off();
this.app.off();
var rootChildren = this.app.root.children;
for (let i = 0; i < rootChildren.length; i++) {
if (rootChildren[i].name !== 'CameraOffset' && rootChildren[i].name !== 'Controller') {
rootChildren[i--].destroy();
}
}
and then loading settings and hierarchy this way
this.app.scenes.loadSceneSettings(nextScene.url, function (ex) {
if (ex) {
console.error(ex.message);
} else { }
});
this.app.scenes.loadSceneHierarchy(nextScene.url, (ex, entity) => {
if (ex) {
console.error(ex.message);
} else { }
});
Principles and methods are copied from the original project so this is the exact same environment.
Here’s the play mode: PlayCanvas | HTML5 Game Engine
Hmm. @mvaligursky if you clone it, you need to change the template asset id in globals.js, since it will be different after cloning. Then use TAB to switch a scene. Quick inspection doesn’t show much. Spector seem to show the buffer contains old data?