cutechicken commited on
Commit
c4be236
โ€ข
1 Parent(s): 4a2055b

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +20 -17
game.js CHANGED
@@ -4,7 +4,7 @@ import { PointerLockControls } from 'three/addons/controls/PointerLockControls.j
4
 
5
  // ๊ฒŒ์ž„ ์ƒ์ˆ˜
6
  const GAME_DURATION = 180;
7
- const MAP_SIZE = 1000;
8
  const TANK_HEIGHT = 0.5;
9
  const ENEMY_GROUND_HEIGHT = 0;
10
  const ENEMY_SCALE = 1;
@@ -1079,23 +1079,26 @@ class Game {
1079
 
1080
  // ๋„์‹œ ๋งต ๋กœ๋“œ
1081
  try {
1082
- const cityMap = await this.loader.loadAsync('/models/map.glb');
1083
- cityMap.scene.traverse((child) => {
1084
- if (child.isMesh) {
1085
- child.castShadow = true;
1086
- child.receiveShadow = true;
1087
- child.material.needsUpdate = true;
1088
-
1089
- // ์ถฉ๋Œ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด obstacles ๋ฐฐ์—ด์— ์ถ”๊ฐ€
1090
- if (child.geometry) {
1091
- this.obstacles.push(child);
1092
- }
1093
- }
1094
- });
1095
- this.scene.add(cityMap.scene);
1096
- } catch (error) {
1097
- console.error('Error loading city map:', error);
1098
  }
 
 
 
 
 
1099
 
1100
  // ํƒฑํฌ ์ดˆ๊ธฐํ™”
1101
  await this.tank.initialize(this.scene, this.loader);
 
4
 
5
  // ๊ฒŒ์ž„ ์ƒ์ˆ˜
6
  const GAME_DURATION = 180;
7
+ const MAP_SIZE = 400;
8
  const TANK_HEIGHT = 0.5;
9
  const ENEMY_GROUND_HEIGHT = 0;
10
  const ENEMY_SCALE = 1;
 
1079
 
1080
  // ๋„์‹œ ๋งต ๋กœ๋“œ
1081
  try {
1082
+ const cityMap = await this.loader.loadAsync('/models/map.glb');
1083
+ cityMap.scene.scale.set(3, 3, 3); // ์Šค์ผ€์ผ์„ 3๋ฐฐ๋กœ ์ฆ๊ฐ€
1084
+ cityMap.scene.traverse((child) => {
1085
+ if (child.isMesh) {
1086
+ child.castShadow = true;
1087
+ child.receiveShadow = true;
1088
+ child.material.needsUpdate = true;
1089
+
1090
+ // ์ถฉ๋Œ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด obstacles ๋ฐฐ์—ด์— ์ถ”๊ฐ€
1091
+ if (child.geometry) {
1092
+ // ์Šค์ผ€์ผ์ด ์ ์šฉ๋œ ์ƒํƒœ๋กœ ์ถฉ๋Œ ๋ฐ•์Šค ์ƒ์„ฑ
1093
+ child.geometry.computeBoundingBox();
1094
+ this.obstacles.push(child);
1095
+ }
 
 
1096
  }
1097
+ });
1098
+ this.scene.add(cityMap.scene);
1099
+ } catch (error) {
1100
+ console.error('Error loading city map:', error);
1101
+ }
1102
 
1103
  // ํƒฑํฌ ์ดˆ๊ธฐํ™”
1104
  await this.tank.initialize(this.scene, this.loader);