Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
@@ -531,9 +531,13 @@ class Fighter {
|
|
531 |
this.velocity.y -= gravityAcceleration;
|
532 |
}
|
533 |
|
534 |
-
// ์๋ ๋ฒกํฐ ๊ณ์ฐ
|
535 |
const noseDirection = new THREE.Vector3(0, 0, 1);
|
536 |
-
|
|
|
|
|
|
|
|
|
537 |
|
538 |
if (!this.stallWarning) {
|
539 |
// ์ ์ ๋นํ ์
|
@@ -590,17 +594,9 @@ class Fighter {
|
|
590 |
|
591 |
// ๋ฉ์ ์์น ๋ฐ ํ์ ์
๋ฐ์ดํธ
|
592 |
this.mesh.position.copy(this.position);
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
const rotationEuler = new THREE.Euler(
|
597 |
-
this.rotation.x,
|
598 |
-
this.rotation.y + 3 * Math.PI / 2,
|
599 |
-
this.rotation.z,
|
600 |
-
'YXZ' // ์ค์ผ๋ฌ ์์ ๋ณ๊ฒฝ์ผ๋ก ์ง๋ฒ ๋ฝ ๋ฐฉ์ง
|
601 |
-
);
|
602 |
-
tempQuaternion.setFromEuler(rotationEuler);
|
603 |
-
this.mesh.quaternion.copy(tempQuaternion);
|
604 |
|
605 |
// ๊ฒฝ๊ณ ๊น๋นก์ ํ์ด๋จธ
|
606 |
this.warningBlinkTimer += deltaTime;
|
@@ -638,7 +634,9 @@ class Fighter {
|
|
638 |
|
639 |
// ๊ธฐ์ ๋์์ ๋ฐ์ฌ (๋ ์์ชฝ์์)
|
640 |
const muzzleOffset = new THREE.Vector3(0, 0, 10);
|
641 |
-
|
|
|
|
|
642 |
bullet.position.copy(this.position).add(muzzleOffset);
|
643 |
|
644 |
// ํํ์ ๋ฐ์ฌ ๋ฐฉํฅ์ผ๋ก ํ์
|
@@ -650,7 +648,7 @@ class Fighter {
|
|
650 |
|
651 |
const bulletSpeed = 1500; // 1000์์ 1500์ผ๋ก ์ฆ๊ฐ (50% ๋น ๋ฅด๊ฒ)
|
652 |
const direction = new THREE.Vector3(0, 0, 1);
|
653 |
-
direction.
|
654 |
bullet.velocity = direction.multiplyScalar(bulletSpeed);
|
655 |
|
656 |
scene.add(bullet);
|
@@ -713,8 +711,11 @@ class Fighter {
|
|
713 |
const backward = new THREE.Vector3(0, 0, -1);
|
714 |
const up = new THREE.Vector3(0, 1, 0);
|
715 |
|
716 |
-
|
717 |
-
|
|
|
|
|
|
|
718 |
|
719 |
const cameraPosition = this.position.clone()
|
720 |
.add(backward.multiplyScalar(this.cameraDistance))
|
|
|
531 |
this.velocity.y -= gravityAcceleration;
|
532 |
}
|
533 |
|
534 |
+
// ์๋ ๋ฒกํฐ ๊ณ์ฐ - ๋งคํธ๋ฆญ์ค๋ฅผ ์ฌ์ฉํ์ฌ ์ง๋ฒ ๋ฝ ํํผ
|
535 |
const noseDirection = new THREE.Vector3(0, 0, 1);
|
536 |
+
|
537 |
+
// ํ์ ๋งคํธ๋ฆญ์ค๋ฅผ ์ง์ ๊ตฌ์ฑํ์ฌ ์ ์ฉ
|
538 |
+
const rotationMatrix = new THREE.Matrix4();
|
539 |
+
rotationMatrix.makeRotationFromEuler(new THREE.Euler(this.rotation.x, this.rotation.y, this.rotation.z, 'YXZ'));
|
540 |
+
noseDirection.applyMatrix4(rotationMatrix);
|
541 |
|
542 |
if (!this.stallWarning) {
|
543 |
// ์ ์ ๋นํ ์
|
|
|
594 |
|
595 |
// ๋ฉ์ ์์น ๋ฐ ํ์ ์
๋ฐ์ดํธ
|
596 |
this.mesh.position.copy(this.position);
|
597 |
+
this.mesh.rotation.x = this.rotation.x;
|
598 |
+
this.mesh.rotation.y = this.rotation.y + 3 * Math.PI / 2;
|
599 |
+
this.mesh.rotation.z = this.rotation.z;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
600 |
|
601 |
// ๊ฒฝ๊ณ ๊น๋นก์ ํ์ด๋จธ
|
602 |
this.warningBlinkTimer += deltaTime;
|
|
|
634 |
|
635 |
// ๊ธฐ์ ๋์์ ๋ฐ์ฌ (๋ ์์ชฝ์์)
|
636 |
const muzzleOffset = new THREE.Vector3(0, 0, 10);
|
637 |
+
const rotationMatrix = new THREE.Matrix4();
|
638 |
+
rotationMatrix.makeRotationFromEuler(new THREE.Euler(this.rotation.x, this.rotation.y, this.rotation.z, 'YXZ'));
|
639 |
+
muzzleOffset.applyMatrix4(rotationMatrix);
|
640 |
bullet.position.copy(this.position).add(muzzleOffset);
|
641 |
|
642 |
// ํํ์ ๋ฐ์ฌ ๋ฐฉํฅ์ผ๋ก ํ์
|
|
|
648 |
|
649 |
const bulletSpeed = 1500; // 1000์์ 1500์ผ๋ก ์ฆ๊ฐ (50% ๋น ๋ฅด๊ฒ)
|
650 |
const direction = new THREE.Vector3(0, 0, 1);
|
651 |
+
direction.applyMatrix4(rotationMatrix);
|
652 |
bullet.velocity = direction.multiplyScalar(bulletSpeed);
|
653 |
|
654 |
scene.add(bullet);
|
|
|
711 |
const backward = new THREE.Vector3(0, 0, -1);
|
712 |
const up = new THREE.Vector3(0, 1, 0);
|
713 |
|
714 |
+
const rotationMatrix = new THREE.Matrix4();
|
715 |
+
rotationMatrix.makeRotationFromEuler(new THREE.Euler(this.rotation.x, this.rotation.y, this.rotation.z, 'YXZ'));
|
716 |
+
|
717 |
+
backward.applyMatrix4(rotationMatrix);
|
718 |
+
up.applyMatrix4(rotationMatrix);
|
719 |
|
720 |
const cameraPosition = this.position.clone()
|
721 |
.add(backward.multiplyScalar(this.cameraDistance))
|