cutechicken commited on
Commit
d50b5f8
โ€ข
1 Parent(s): 678cd65

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +4 -3
game.js CHANGED
@@ -444,7 +444,6 @@ class Game {
444
 
445
  if (direction.length() > 0) {
446
  direction.normalize();
447
- // ํƒฑํฌ์˜ ํ˜„์žฌ ํšŒ์ „์„ ๊ธฐ์ค€์œผ๋กœ ์ด๋™
448
  direction.applyEuler(this.tank.body.rotation);
449
  this.tank.move(direction);
450
 
@@ -455,8 +454,10 @@ class Game {
455
  }
456
  }
457
 
458
- // ๋งˆ์šฐ์Šค ์›€์ง์ž„์— ๋”ฐ๋ฅธ ํฌํƒ‘๊ณผ ์นด๋ฉ”๋ผ ํšŒ์ „
459
- const rotationAngle = Math.atan2(this.mouse.x, -this.mouse.y);
 
 
460
 
461
  // ํฌํƒ‘ ํšŒ์ „
462
  if (this.tank.turretGroup) {
 
444
 
445
  if (direction.length() > 0) {
446
  direction.normalize();
 
447
  direction.applyEuler(this.tank.body.rotation);
448
  this.tank.move(direction);
449
 
 
454
  }
455
  }
456
 
457
+ // ๋งˆ์šฐ์Šค ์œ„์น˜๋ฅผ ํƒฑํฌ ๊ธฐ์ค€์œผ๋กœ ๋ณ€ํ™˜
458
+ const tankRotation = this.tank.body.rotation.y;
459
+ const mouseVector = new THREE.Vector2(this.mouse.x, -this.mouse.y);
460
+ const rotationAngle = Math.atan2(mouseVector.x, mouseVector.y) + tankRotation;
461
 
462
  // ํฌํƒ‘ ํšŒ์ „
463
  if (this.tank.turretGroup) {