cutechicken commited on
Commit
3132a78
·
verified ·
1 Parent(s): 57e9535

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +14 -15
game.js CHANGED
@@ -327,10 +327,10 @@ class Game {
327
  async initialize() {
328
  try {
329
  // 안개 효과 조정
330
- this.scene.fog = new THREE.Fog(0xC2B280, 1, 150); // 자연스러운 사막색
331
  this.scene.background = new THREE.Color(0x87CEEB); // 하늘색 배경
332
 
333
- const ambientLight = new THREE.AmbientLight(0xffffff, 0.6); // 주변광 감소
334
  this.scene.add(ambientLight);
335
 
336
  const directionalLight = new THREE.DirectionalLight(0xffffff, 1.2); // 태양광 강화
@@ -553,19 +553,18 @@ async addDesertDecorations() {
553
  const cameraHeight = 15;
554
  const lookAtHeight = 5;
555
 
556
- const tankRotation = this.tank.body.rotation.y;
557
-
558
- this.camera.position.set(
559
- tankPos.x - Math.sin(tankRotation) * cameraDistance,
560
- tankPos.y + cameraHeight,
561
- tankPos.z - Math.cos(tankRotation) * cameraDistance
562
- );
563
-
564
- const lookAtPoint = new THREE.Vector3(
565
- tankPos.x + Math.sin(tankRotation) * 10,
566
- tankPos.y + lookAtHeight,
567
- tankPos.z + Math.cos(tankRotation) * 10
568
- );
569
 
570
  this.camera.lookAt(lookAtPoint);
571
  }
 
327
  async initialize() {
328
  try {
329
  // 안개 효과 조정
330
+ this.scene.fog = new THREE.Fog(0xC2B280, 50, 250); // 안개 시작 거리를 늘리고 끝나는 거리도 증가
331
  this.scene.background = new THREE.Color(0x87CEEB); // 하늘색 배경
332
 
333
+ const ambientLight = new THREE.AmbientLight(0xffffff, 1.0); // 주변광 강도 증가
334
  this.scene.add(ambientLight);
335
 
336
  const directionalLight = new THREE.DirectionalLight(0xffffff, 1.2); // 태양광 강화
 
553
  const cameraHeight = 15;
554
  const lookAtHeight = 5;
555
 
556
+ const turretRotation = this.tank.turretGroup.rotation.y + this.tank.body.rotation.y;
557
+ this.camera.position.set(
558
+ tankPos.x - Math.sin(turretRotation) * cameraDistance,
559
+ tankPos.y + cameraHeight,
560
+ tankPos.z - Math.cos(turretRotation) * cameraDistance
561
+ );
562
+
563
+ const lookAtPoint = new THREE.Vector3(
564
+ tankPos.x + Math.sin(turretRotation) * 10,
565
+ tankPos.y + lookAtHeight,
566
+ tankPos.z + Math.cos(turretRotation) * 10
567
+ );
 
568
 
569
  this.camera.lookAt(lookAtPoint);
570
  }