From 0a1a4957f1450a65adf3f990c12d7e8790883020 Mon Sep 17 00:00:00 2001 From: omar salah <114373468+omarsalaheldieen@users.noreply.github.com> Date: Fri, 14 Jun 2024 02:06:20 +0300 Subject: [PATCH] Update SCript --- assets/arTab/ar1.html | 4 +- assets/arTab/ar2.html | 28 +++++++--- assets/arTab/ar3.html | 28 +++++++--- index.html | 117 ++++++++++++++++++++++-------------------- rotation_limit.js | 12 +++++ 5 files changed, 116 insertions(+), 73 deletions(-) create mode 100644 rotation_limit.js diff --git a/assets/arTab/ar1.html b/assets/arTab/ar1.html index 55b549a..54dc012 100644 --- a/assets/arTab/ar1.html +++ b/assets/arTab/ar1.html @@ -12,7 +12,9 @@ - + + + diff --git a/assets/arTab/ar2.html b/assets/arTab/ar2.html index 3cdbe2a..043de6c 100644 --- a/assets/arTab/ar2.html +++ b/assets/arTab/ar2.html @@ -6,15 +6,27 @@ - - - - - + + + - + + + - - \ No newline at end of file + diff --git a/assets/arTab/ar3.html b/assets/arTab/ar3.html index 796f887..043de6c 100644 --- a/assets/arTab/ar3.html +++ b/assets/arTab/ar3.html @@ -6,15 +6,27 @@ - - - - - + + + - + + + - - \ No newline at end of file + diff --git a/index.html b/index.html index 598bf38..ef42720 100644 --- a/index.html +++ b/index.html @@ -1,68 +1,73 @@ - - - - + + + AR Menu - + - + - +
- - + +
- - - - - \ No newline at end of file + + + diff --git a/rotation_limit.js b/rotation_limit.js new file mode 100644 index 0000000..2c1ff4d --- /dev/null +++ b/rotation_limit.js @@ -0,0 +1,12 @@ +AFRAME.registerComponent('rotation-limiter', { + tick: function () { + var el = this.el; + var rotation = el.getAttribute('rotation'); + + rotation.x = Math.max(0, Math.min(90, rotation.x)); + rotation.y = Math.max(0, Math.min(90, rotation.y)); + rotation.z = Math.max(0, Math.min(90, rotation.z)); + + el.setAttribute('rotation', rotation); + } +}); \ No newline at end of file