Spaces:
Running
Running
Update index.html
Browse files- index.html +16 -10
index.html
CHANGED
|
@@ -632,10 +632,12 @@
|
|
| 632 |
}
|
| 633 |
|
| 634 |
updateMouseInput(deltaX, deltaY) {
|
| 635 |
-
// ์์ฌ๋ ์คํ์ผ: ๋ง์ฐ์ค X์ถ -> ๋กค(๋ ๊ฐ ๊ธฐ์ธ์ด๊ธฐ)
|
| 636 |
const sensitivity = GAME_CONSTANTS.MOUSE_SENSITIVITY * 2.0;
|
| 637 |
|
| 638 |
-
// X์ถ (์ข/์ฐ) -> ๋กค (๋ ๊ฐ
|
|
|
|
|
|
|
| 639 |
this.targetRoll += deltaX * sensitivity;
|
| 640 |
|
| 641 |
// Y์ถ (์/์๋) -> ํผ์น (๊ธฐ์ ์ํ)
|
|
@@ -643,7 +645,7 @@
|
|
| 643 |
|
| 644 |
// ๊ฐ๋ ์ ํ
|
| 645 |
const maxPitchAngle = Math.PI / 3; // 60๋
|
| 646 |
-
const maxRollAngle = Math.PI
|
| 647 |
|
| 648 |
this.targetPitch = Math.max(-maxPitchAngle, Math.min(maxPitchAngle, this.targetPitch));
|
| 649 |
this.targetRoll = Math.max(-maxRollAngle, Math.min(maxRollAngle, this.targetRoll));
|
|
@@ -673,14 +675,18 @@
|
|
| 673 |
// ๋ถ๋๋ฌ์ด ํ์ ๋ณด๊ฐ
|
| 674 |
const rotationSpeed = deltaTime * 3.0;
|
| 675 |
this.rotation.x = THREE.MathUtils.lerp(this.rotation.x, this.targetPitch, rotationSpeed);
|
| 676 |
-
this.rotation.y = THREE.MathUtils.lerp(this.rotation.y, this.targetYaw, rotationSpeed);
|
| 677 |
this.rotation.z = THREE.MathUtils.lerp(this.rotation.z, this.targetRoll, rotationSpeed);
|
| 678 |
|
| 679 |
-
// ์์ฌ๋ ์คํ์ผ: ๋กค์ ๋ฐ๋ฅธ ์์ฐ์ค๋ฌ์ด
|
| 680 |
-
// ๋ ๊ฐ๊ฐ ๊ธฐ์ธ์ด์ง๋ฉด ์๋์ผ๋ก
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
|
| 685 |
// ๊ธฐ๋ณธ ์๋ ๊ณ์ฐ
|
| 686 |
const minSpeed = 100;
|
|
@@ -699,7 +705,7 @@
|
|
| 699 |
// ์คํจ ๊ฒฝ๊ณ
|
| 700 |
this.stallWarning = this.speed < GAME_CONSTANTS.STALL_SPEED;
|
| 701 |
|
| 702 |
-
// ์๋ ๋ฒกํฐ ๊ณ์ฐ
|
| 703 |
const noseDirection = new THREE.Vector3(0, 0, 1);
|
| 704 |
noseDirection.applyEuler(this.rotation);
|
| 705 |
this.velocity = noseDirection.multiplyScalar(this.speed);
|
|
|
|
| 632 |
}
|
| 633 |
|
| 634 |
updateMouseInput(deltaX, deltaY) {
|
| 635 |
+
// ์์ฌ๋ ์คํ์ผ: ๋ง์ฐ์ค X์ถ -> ๋กค(๋ ๊ฐ ๊ธฐ์ธ์ด๊ธฐ)๋ง, Y์ถ -> ํผ์น
|
| 636 |
const sensitivity = GAME_CONSTANTS.MOUSE_SENSITIVITY * 2.0;
|
| 637 |
|
| 638 |
+
// X์ถ (์ข/์ฐ) -> ๋กค (๋ ๊ฐ ๊ธฐ์ธ์ด๊ธฐ๋ง)
|
| 639 |
+
// ๋ง์ฐ์ค๋ฅผ ์ค๋ฅธ์ชฝ์ผ๋ก ์ด๋ = ์ค๋ฅธ์ชฝ ๋ ๊ฐ ์๋๋ก (์์ ๋กค)
|
| 640 |
+
// ๋ง์ฐ์ค๋ฅผ ์ผ์ชฝ์ผ๋ก ์ด๋ = ์ผ์ชฝ ๋ ๊ฐ ์๋๋ก (์์ ๋กค)
|
| 641 |
this.targetRoll += deltaX * sensitivity;
|
| 642 |
|
| 643 |
// Y์ถ (์/์๋) -> ํผ์น (๊ธฐ์ ์ํ)
|
|
|
|
| 645 |
|
| 646 |
// ๊ฐ๋ ์ ํ
|
| 647 |
const maxPitchAngle = Math.PI / 3; // 60๋
|
| 648 |
+
const maxRollAngle = Math.PI; // 180๋ (์์ ๋ค์ง๊ธฐ ๊ฐ๋ฅ)
|
| 649 |
|
| 650 |
this.targetPitch = Math.max(-maxPitchAngle, Math.min(maxPitchAngle, this.targetPitch));
|
| 651 |
this.targetRoll = Math.max(-maxRollAngle, Math.min(maxRollAngle, this.targetRoll));
|
|
|
|
| 675 |
// ๋ถ๋๋ฌ์ด ํ์ ๋ณด๊ฐ
|
| 676 |
const rotationSpeed = deltaTime * 3.0;
|
| 677 |
this.rotation.x = THREE.MathUtils.lerp(this.rotation.x, this.targetPitch, rotationSpeed);
|
|
|
|
| 678 |
this.rotation.z = THREE.MathUtils.lerp(this.rotation.z, this.targetRoll, rotationSpeed);
|
| 679 |
|
| 680 |
+
// ์์ฌ๋ ์คํ์ผ: ๋กค์ ๋ฐ๋ฅธ ์์ฐ์ค๋ฌ์ด ์(Yaw) ํ์
|
| 681 |
+
// ๋ ๊ฐ๊ฐ ๊ธฐ์ธ์ด์ง๋ฉด ์๋์ผ๋ก ๊ทธ ๋ฐฉํฅ์ผ๋ก ์ ํ
|
| 682 |
+
if (Math.abs(this.rotation.z) > 0.1) { // ์ฝ๊ฐ์ ๋ฐ๋์กด
|
| 683 |
+
const bankAngle = this.rotation.z;
|
| 684 |
+
const bankTurnRate = Math.sin(bankAngle) * deltaTime * 0.7; // ์ ํ์จ
|
| 685 |
+
this.targetYaw += bankTurnRate;
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
// ์ ํ์ ์ ์ฉ (A/D ํค ์
๋ ฅ + ์๋ ์ ํ)
|
| 689 |
+
this.rotation.y = THREE.MathUtils.lerp(this.rotation.y, this.targetYaw, rotationSpeed);
|
| 690 |
|
| 691 |
// ๊ธฐ๋ณธ ์๋ ๊ณ์ฐ
|
| 692 |
const minSpeed = 100;
|
|
|
|
| 705 |
// ์คํจ ๊ฒฝ๊ณ
|
| 706 |
this.stallWarning = this.speed < GAME_CONSTANTS.STALL_SPEED;
|
| 707 |
|
| 708 |
+
// ์๋ ๋ฒกํฐ ๊ณ์ฐ - ์ ํฌ๊ธฐ๊ฐ ํฅํ๋ ๋ฐฉํฅ์ผ๋ก ์ด๋
|
| 709 |
const noseDirection = new THREE.Vector3(0, 0, 1);
|
| 710 |
noseDirection.applyEuler(this.rotation);
|
| 711 |
this.velocity = noseDirection.multiplyScalar(this.speed);
|