Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
@@ -28,15 +28,6 @@
|
|
28 |
var minAngle = parseFloat(getScriptQueryParam("minAngle") || "0");
|
29 |
var maxAngle = parseFloat(getScriptQueryParam("maxAngle") || "360");
|
30 |
|
31 |
-
// Optional parameters for translation limits.
|
32 |
-
// Defaults: no restriction.
|
33 |
-
var minX = parseFloat(getScriptQueryParam("minX") || "-Infinity");
|
34 |
-
var maxX = parseFloat(getScriptQueryParam("maxX") || "Infinity");
|
35 |
-
var minY = parseFloat(getScriptQueryParam("minY") || "-Infinity");
|
36 |
-
var maxY = parseFloat(getScriptQueryParam("maxY") || "Infinity");
|
37 |
-
var minZ = parseFloat(getScriptQueryParam("minZ") || "-Infinity");
|
38 |
-
var maxZ = parseFloat(getScriptQueryParam("maxZ") || "Infinity");
|
39 |
-
|
40 |
// Detect if the device is iOS.
|
41 |
var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
42 |
|
@@ -278,7 +269,7 @@
|
|
278 |
resetCameraBtn.addEventListener('click', function() {
|
279 |
console.log("Reset camera button clicked.");
|
280 |
if (cameraInstance && initialCameraPosition && initialCameraRotation) {
|
281 |
-
//
|
282 |
cameraInstance.position = initialCameraPosition.clone();
|
283 |
cameraInstance.rotation = initialCameraRotation.clone();
|
284 |
if (typeof cameraInstance.update === 'function') {
|
@@ -341,10 +332,6 @@
|
|
341 |
|
342 |
const frame = () => {
|
343 |
controls.update();
|
344 |
-
// Clamp camera position to the allowed translation limits.
|
345 |
-
camera.position.x = Math.min(Math.max(camera.position.x, minX), maxX);
|
346 |
-
camera.position.y = Math.min(Math.max(camera.position.y, minY), maxY);
|
347 |
-
camera.position.z = Math.min(Math.max(camera.position.z, minZ), maxZ);
|
348 |
renderer.render(scene, camera);
|
349 |
requestAnimationFrame(frame);
|
350 |
};
|
|
|
28 |
var minAngle = parseFloat(getScriptQueryParam("minAngle") || "0");
|
29 |
var maxAngle = parseFloat(getScriptQueryParam("maxAngle") || "360");
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
// Detect if the device is iOS.
|
32 |
var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
33 |
|
|
|
269 |
resetCameraBtn.addEventListener('click', function() {
|
270 |
console.log("Reset camera button clicked.");
|
271 |
if (cameraInstance && initialCameraPosition && initialCameraRotation) {
|
272 |
+
// Reset camera's position and rotation using clone().
|
273 |
cameraInstance.position = initialCameraPosition.clone();
|
274 |
cameraInstance.rotation = initialCameraRotation.clone();
|
275 |
if (typeof cameraInstance.update === 'function') {
|
|
|
332 |
|
333 |
const frame = () => {
|
334 |
controls.update();
|
|
|
|
|
|
|
|
|
335 |
renderer.render(scene, camera);
|
336 |
requestAnimationFrame(frame);
|
337 |
};
|