Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -621,9 +621,13 @@ with gr.Blocks(css=css) as demo:
|
|
621 |
const dir = BABYLON.Engine.LastCreatedScene.activeCamera.getForwardRay().direction;
|
622 |
dir.y = 0; dir.normalize();
|
623 |
const angle = BABYLON.Vector3.GetAngleBetweenVectors(dir, BABYLON.Vector3.Forward(), BABYLON.Vector3.Up());
|
624 |
-
alert(angle);
|
625 |
-
|
626 |
-
|
|
|
|
|
|
|
|
|
627 |
}
|
628 |
} catch(e) {alert(e)}
|
629 |
' onkeydown='
|
|
|
621 |
const dir = BABYLON.Engine.LastCreatedScene.activeCamera.getForwardRay().direction;
|
622 |
dir.y = 0; dir.normalize();
|
623 |
const angle = BABYLON.Vector3.GetAngleBetweenVectors(dir, BABYLON.Vector3.Forward(), BABYLON.Vector3.Up());
|
624 |
+
//alert(angle);
|
625 |
+
const x = event.clientX-this.getBoundingClientRect().x-64;
|
626 |
+
const y = event.clientY-this.getBoundingClientRect().y-64;
|
627 |
+
const angle_ = Math.atan2(y, x);
|
628 |
+
const r = Math.sqrt(Math.pow(y,2) + Math.pow(x,2));
|
629 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.z = r * Math.cos(angle_-angle);
|
630 |
+
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.x = r * Math.sin(angle_-angle);
|
631 |
}
|
632 |
} catch(e) {alert(e)}
|
633 |
' onkeydown='
|