Hi, I have two cameras. One for the player, and other orbital for a general view of the project.
I need change one for the other when I press a button.
I saw that tutorial:
https://playcanvas.com/editor/scene/440116
And this is a part of my code, the script is attatched on the root:
The initial values:
var camMode = 0;
this.activeCamera = this.orbitalCamera;
When you press the button:
if(camMode === 0){
camMode = 1;
this.activeCamera.enabled = false;
this.activeCamera = this.normalCamera;
this.activeCamera.enabled = true;
}
else if(camMode === 1){
camMode = 0;
this.activeCamera.enabled = false;
this.activeCamera = this.orbitalCamera;
this.activeCamera.enabled = true;
}
And this is the error when i press the button:
Uncaught TypeError: Cannot set property ‘enabled’ of undefined
Thanks.