repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 32bfd5c5db10ed9e1f237b551daf71f853fb0d07:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 32bfd5c5db10ed9e1f237b551daf71f853fb0d07
Author: James Baicoianu 
Date:   Thu Oct 17 17:17:43 2024 -0700

    Added player.setCameraView() function

diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
index a06af9a85e344107182bb419d3670ed67abb47fa..
index ..4669138bd20996818eae4c42cea62e308f79a828 100644
--- 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-----