Ok so we have 2 scenes, a movement test scene and a library with a portal. When you take the portal, delete the current scene and bring in the new scene, the camera will be stuck far away from the player. But you can still see the player and see them move around. We are unsure why this is happening.
Here is the portal code.
var PortalTrigger = pc.createScript('portalTrigger');
PortalTrigger.attributes.add('DestinationScene', {type: "string"});
// initialize code called once per entity
PortalTrigger.prototype.initialize = function() {
this.entity.collision.on('triggerenter', this.loadScene, this);
};
PortalTrigger.prototype.loadScene = function() {
var oldHierarchy = this.app.root.findByName('Root');
var scene = this.app.scenes.find(this.DestinationScene);
this.app.scenes.loadSceneHierarchy(scene.url, function(error, parent) {
if(!error) {
oldHierarchy.destroy();
} else {
console.error(error);
}
});
};
Link to the project: PlayCanvas | HTML5 Game Engine