Spaces:
Running
Running
Simplify joystick: yaw + pitch only, remove slider
Browse files- Joystick X axis: Yaw (turn head left/right)
- Joystick Y axis: Pitch (look up/down)
- Removed roll slider - roll stays at 0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- index.html +4 -16
index.html
CHANGED
|
@@ -725,13 +725,8 @@
|
|
| 725 |
<div class="joystick-knob" id="joystickKnob"></div>
|
| 726 |
<span class="joystick-label top">Up</span>
|
| 727 |
<span class="joystick-label bottom">Down</span>
|
| 728 |
-
<span class="joystick-label left">
|
| 729 |
-
<span class="joystick-label right">
|
| 730 |
-
</div>
|
| 731 |
-
<div class="roll-control">
|
| 732 |
-
<span class="roll-label">Turn L</span>
|
| 733 |
-
<input type="range" class="roll-slider" id="yawSlider" min="-100" max="100" value="0">
|
| 734 |
-
<span class="roll-label">Turn R</span>
|
| 735 |
</div>
|
| 736 |
</div>
|
| 737 |
<div class="joystick-hint">Hold and drag to move head continuously</div>
|
|
@@ -1219,9 +1214,6 @@
|
|
| 1219 |
document.addEventListener('mouseup', endJoystick);
|
| 1220 |
document.addEventListener('touchend', endJoystick);
|
| 1221 |
|
| 1222 |
-
const yawSlider = document.getElementById('yawSlider');
|
| 1223 |
-
yawSlider.addEventListener('mouseup', () => { yawSlider.value = 0; });
|
| 1224 |
-
yawSlider.addEventListener('touchend', () => { yawSlider.value = 0; });
|
| 1225 |
}
|
| 1226 |
|
| 1227 |
function startContinuousMovement() {
|
|
@@ -1231,16 +1223,12 @@
|
|
| 1231 |
if (!joystickActive) return;
|
| 1232 |
|
| 1233 |
const speed = 1.5; // degrees per tick
|
| 1234 |
-
const yawSlider = document.getElementById('yawSlider');
|
| 1235 |
-
const yawInput = parseFloat(yawSlider.value) / 100;
|
| 1236 |
|
| 1237 |
// Joystick mapping:
|
| 1238 |
-
// Left/Right (X) controls
|
| 1239 |
// Up/Down (Y) controls Pitch: up = look up (negative pitch)
|
| 1240 |
-
|
| 1241 |
-
targetRoll += joystickX * speed;
|
| 1242 |
targetPitch += joystickY * speed;
|
| 1243 |
-
targetYaw += -yawInput * speed;
|
| 1244 |
|
| 1245 |
// Clamp to limits
|
| 1246 |
targetYaw = Math.max(-45, Math.min(45, targetYaw));
|
|
|
|
| 725 |
<div class="joystick-knob" id="joystickKnob"></div>
|
| 726 |
<span class="joystick-label top">Up</span>
|
| 727 |
<span class="joystick-label bottom">Down</span>
|
| 728 |
+
<span class="joystick-label left">Left</span>
|
| 729 |
+
<span class="joystick-label right">Right</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 730 |
</div>
|
| 731 |
</div>
|
| 732 |
<div class="joystick-hint">Hold and drag to move head continuously</div>
|
|
|
|
| 1214 |
document.addEventListener('mouseup', endJoystick);
|
| 1215 |
document.addEventListener('touchend', endJoystick);
|
| 1216 |
|
|
|
|
|
|
|
|
|
|
| 1217 |
}
|
| 1218 |
|
| 1219 |
function startContinuousMovement() {
|
|
|
|
| 1223 |
if (!joystickActive) return;
|
| 1224 |
|
| 1225 |
const speed = 1.5; // degrees per tick
|
|
|
|
|
|
|
| 1226 |
|
| 1227 |
// Joystick mapping:
|
| 1228 |
+
// Left/Right (X) controls Yaw: right = turn right (negative yaw)
|
| 1229 |
// Up/Down (Y) controls Pitch: up = look up (negative pitch)
|
| 1230 |
+
targetYaw += -joystickX * speed;
|
|
|
|
| 1231 |
targetPitch += joystickY * speed;
|
|
|
|
| 1232 |
|
| 1233 |
// Clamp to limits
|
| 1234 |
targetYaw = Math.max(-45, Math.min(45, targetYaw));
|