Spaces:
Running
Running
cutechicken
commited on
Commit
โข
d50b5f8
1
Parent(s):
678cd65
Update game.js
Browse files
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
|
|
|
|
|
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) {
|