freealise commited on
Commit
536ab01
1 Parent(s): 02eb864

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -357,10 +357,12 @@ with gr.Blocks(css=css) as demo:
357
  BABYLON.Engine.LastCreatedScene.activeCamera.radius = 0;
358
  }
359
  try {
360
- BABYLON.Engine.LastCreatedScene.activeCamera.position = new BABYLON.Vector3(0,0,0);
361
- BABYLON.Engine.LastCreatedScene.activeCamera.radius = -255;
 
 
362
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.zero = new BABYLON.Vector3(0,0,0);
363
- BABYLON.Engine.LastCreatedScene.activeCamera.metadata.CoR_At = new BABYLON.Vector3(BABYLON.Engine.LastCreatedScene.activeCamera.position.x, BABYLON.Engine.LastCreatedScene.activeCamera.position.y, BABYLON.Engine.LastCreatedScene.activeCamera.position.z);
364
 
365
  BABYLON.Engine.LastCreatedScene.activeCamera.setTarget(BABYLON.Engine.LastCreatedScene.activeCamera.metadata.CoR_At);
366
  BABYLON.Engine.LastCreatedScene.activeCamera.radius = 255;
 
357
  BABYLON.Engine.LastCreatedScene.activeCamera.radius = 0;
358
  }
359
  try {
360
+ var x = -255 * Math.cos(BABYLON.Engine.LastCreatedScene.activeCamera.alpha) * Math.sin(BABYLON.Engine.LastCreatedScene.activeCamera.beta)
361
+ var y = -255 * Math.cos(BABYLON.Engine.LastCreatedScene.activeCamera.beta)
362
+ var z = -255 * Math.sin(BABYLON.Engine.LastCreatedScene.activeCamera.alpha) * Math.sin(BABYLON.Engine.LastCreatedScene.activeCamera.beta)
363
+
364
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.zero = new BABYLON.Vector3(0,0,0);
365
+ BABYLON.Engine.LastCreatedScene.activeCamera.metadata.CoR_At = new BABYLON.Vector3(x, y, z);
366
 
367
  BABYLON.Engine.LastCreatedScene.activeCamera.setTarget(BABYLON.Engine.LastCreatedScene.activeCamera.metadata.CoR_At);
368
  BABYLON.Engine.LastCreatedScene.activeCamera.radius = 255;