cutechicken commited on
Commit
15a66ff
โ€ข
1 Parent(s): 6bacfac

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +6 -6
game.js CHANGED
@@ -106,9 +106,9 @@ class TankPlayer {
106
  update(mouseX, mouseY, scene) {
107
  if (!this.body || !this.turretGroup) return;
108
 
109
- // ์นด๋ฉ”๋ผ ๋ฐฉํ–ฅ์œผ๋กœ ํฌํƒ‘ ํšŒ์ „
110
  this.turretGroup.rotation.y = mouseX;
111
- this.turretRotation = mouseX + this.body.rotation.y;
112
 
113
  // ํ”Œ๋ ˆ์ด์–ด ์ด์•Œ ์—…๋ฐ์ดํŠธ
114
  for (let i = this.bullets.length - 1; i >= 0; i--) {
@@ -526,6 +526,7 @@ async addDesertDecorations() {
526
 
527
  const direction = new THREE.Vector3();
528
 
 
529
  if (this.keys.forward) direction.z += 1;
530
  if (this.keys.backward) direction.z -= 1;
531
  if (this.keys.left) this.tank.rotate(-1);
@@ -540,12 +541,10 @@ async addDesertDecorations() {
540
  // ํƒฑํฌ ์œ„์น˜ ๊ฐ€์ ธ์˜ค๊ธฐ
541
  const tankPos = this.tank.getPosition();
542
 
543
- // ์นด๋ฉ”๋ผ ์œ„์น˜ ๊ณ„์‚ฐ
544
  const cameraDistance = 30;
545
  const cameraHeight = 15;
546
-
547
- // ๋งˆ์šฐ์Šค X ๊ฐ’์„ ์นด๋ฉ”๋ผ ๊ฐ๋„๋กœ ์‚ฌ์šฉ
548
- const cameraAngle = this.mouse.x + Math.PI;
549
 
550
  const cameraX = tankPos.x + Math.sin(cameraAngle) * cameraDistance;
551
  const cameraZ = tankPos.z + Math.cos(cameraAngle) * cameraDistance;
@@ -564,6 +563,7 @@ async addDesertDecorations() {
564
  );
565
  this.camera.lookAt(lookAtPoint);
566
  }
 
567
  //this.camera.lookAt(lookAtPoint);
568
 
569
 
 
106
  update(mouseX, mouseY, scene) {
107
  if (!this.body || !this.turretGroup) return;
108
 
109
+ // ํฌํƒ‘์˜ ์ ˆ๋Œ€ ํšŒ์ „ (์ฐจ์ฒด ํšŒ์ „๊ณผ ๋…๋ฆฝ์ )
110
  this.turretGroup.rotation.y = mouseX;
111
+ this.turretRotation = mouseX; // ์ฐจ์ฒด ํšŒ์ „์„ ๋”ํ•˜์ง€ ์•Š์Œ
112
 
113
  // ํ”Œ๋ ˆ์ด์–ด ์ด์•Œ ์—…๋ฐ์ดํŠธ
114
  for (let i = this.bullets.length - 1; i >= 0; i--) {
 
526
 
527
  const direction = new THREE.Vector3();
528
 
529
+ // ์ฐจ์ฒด ์ด๋™๊ณผ ํšŒ์ „์€ ์œ ์ง€
530
  if (this.keys.forward) direction.z += 1;
531
  if (this.keys.backward) direction.z -= 1;
532
  if (this.keys.left) this.tank.rotate(-1);
 
541
  // ํƒฑํฌ ์œ„์น˜ ๊ฐ€์ ธ์˜ค๊ธฐ
542
  const tankPos = this.tank.getPosition();
543
 
544
+ // ์นด๋ฉ”๋ผ๋Š” ๋งˆ์šฐ์Šค X ํšŒ์ „์—๋งŒ ๋”ฐ๋ผ๊ฐ
545
  const cameraDistance = 30;
546
  const cameraHeight = 15;
547
+ const cameraAngle = this.mouse.x + Math.PI; // ํ•ญ์ƒ ํฌํƒ‘์˜ ๋’ค์ชฝ์— ์œ„์น˜
 
 
548
 
549
  const cameraX = tankPos.x + Math.sin(cameraAngle) * cameraDistance;
550
  const cameraZ = tankPos.z + Math.cos(cameraAngle) * cameraDistance;
 
563
  );
564
  this.camera.lookAt(lookAtPoint);
565
  }
566
+
567
  //this.camera.lookAt(lookAtPoint);
568
 
569