cutechicken commited on
Commit
c3185e4
โ€ข
1 Parent(s): accbf92

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +6 -5
game.js CHANGED
@@ -374,8 +374,8 @@ class Game {
374
  }
375
 
376
  // FPS ์นด๋ฉ”๋ผ ์„ค์ •
377
- this.camera.position.set(0, 2, 0);
378
- this.controls = new PointerLockControls(this.camera, document.body);
379
 
380
  // ๋กœ๋”ฉ ์™„๋ฃŒ
381
  this.isLoading = false;
@@ -465,9 +465,10 @@ class Game {
465
 
466
  // ์นด๋ฉ”๋ผ์™€ ํƒฑํฌ ๋™๊ธฐํ™”
467
  const tankPos = this.tank.getPosition();
468
- this.camera.position.x = tankPos.x;
469
- this.camera.position.z = tankPos.z;
470
- this.camera.position.y = tankPos.y + 2;
 
471
 
472
  // ํฌํƒ‘ ํšŒ์ „์„ ์นด๋ฉ”๋ผ์™€ ๋™๊ธฐํ™”
473
  if (this.tank.turret) {
 
374
  }
375
 
376
  // FPS ์นด๋ฉ”๋ผ ์„ค์ •
377
+ this.camera.position.set(-15, 10, -15);
378
+ this.camera.lookAt(new THREE.Vector3(0, 0, 0));
379
 
380
  // ๋กœ๋”ฉ ์™„๋ฃŒ
381
  this.isLoading = false;
 
465
 
466
  // ์นด๋ฉ”๋ผ์™€ ํƒฑํฌ ๋™๊ธฐํ™”
467
  const tankPos = this.tank.getPosition();
468
+ const cameraOffset = new THREE.Vector3(-15, 10, -15);
469
+ cameraOffset.applyQuaternion(this.tank.body.quaternion);
470
+ this.camera.position.copy(tankPos).add(cameraOffset);
471
+ this.camera.lookAt(tankPos);
472
 
473
  // ํฌํƒ‘ ํšŒ์ „์„ ์นด๋ฉ”๋ผ์™€ ๋™๊ธฐํ™”
474
  if (this.tank.turret) {