repo: janusweb action: commit revision: path_from: revision_from: 32bfd5c5db10ed9e1f237b551daf71f853fb0d07: path_to: revision_to:
commit 32bfd5c5db10ed9e1f237b551daf71f853fb0d07 Author: James BaicoianuDate: Thu Oct 17 17:17:43 2024 -0700 Added player.setCameraView() function diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
--- a/scripts/janusplayer.js
+++ b/scripts/janusplayer.js
@@ -1234,19 +1234,25 @@ document.body.dispatchEvent(click);
this.toggleCamera = function(ev) {
if (ev.value == 1) {
if (this.cameraview == 'firstperson') {
- this.cameraview = 'thirdperson';
- this.cameraangle = 0;
- this.camerazoom = 2;
- this.cameraheight = .25;
+ this.setCameraView('thirdperson');
} else {
- this.cameraview = 'firstperson';
- this.cameraangle = 0;
- this.camerazoom = 0;
- this.cameraheight = 0;
+ this.setCameraView('firstperson');
}
- this.updateCamera();
}
}
+ this.setCameraView = function(cameraview) {
+ this.cameraview = cameraview;
+ if (this.cameraview == 'thirdperson') {
+ this.cameraangle = 0;
+ this.camerazoom = 2;
+ this.cameraheight = .25;
+ } else if (this.cameraview == 'firstperson') {
+ this.cameraangle = 0;
+ this.camerazoom = 0;
+ this.cameraheight = 0;
+ }
+ this.updateCamera();
+ }
this.zoomView = function(amount, ev) {
if (this.cameraview == 'thirdperson') {
//this.camera.position.z -= amount / 10;
-----END OF PAGE-----