Spaces:
Running
Running
cutechicken
commited on
Commit
โข
762fa4e
1
Parent(s):
e4939a8
Update game.js
Browse files
game.js
CHANGED
@@ -162,15 +162,17 @@ class TankPlayer {
|
|
162 |
const turretResult = await loader.loadAsync('/models/abramsTurret.glb');
|
163 |
this.turret = turretResult.scene;
|
164 |
|
165 |
-
|
166 |
this.turretGroup.position.y = 0.2;
|
167 |
this.turretGroup.add(this.turret);
|
168 |
this.body.add(this.turretGroup);
|
169 |
|
|
|
170 |
this.body.traverse((child) => {
|
171 |
if (child.isMesh) {
|
172 |
child.castShadow = true;
|
173 |
child.receiveShadow = true;
|
|
|
|
|
174 |
}
|
175 |
});
|
176 |
|
@@ -178,9 +180,22 @@ class TankPlayer {
|
|
178 |
if (child.isMesh) {
|
179 |
child.castShadow = true;
|
180 |
child.receiveShadow = true;
|
|
|
|
|
181 |
}
|
182 |
});
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
// ์ฌ๊ธฐ์ ์ ํจํ ์คํฐ ์์น๋ฅผ ์ฐพ์ ์ ์ฉ
|
185 |
if (window.gameInstance) {
|
186 |
const spawnPos = window.gameInstance.findValidSpawnPosition();
|
|
|
162 |
const turretResult = await loader.loadAsync('/models/abramsTurret.glb');
|
163 |
this.turret = turretResult.scene;
|
164 |
|
|
|
165 |
this.turretGroup.position.y = 0.2;
|
166 |
this.turretGroup.add(this.turret);
|
167 |
this.body.add(this.turretGroup);
|
168 |
|
169 |
+
// ๊ทธ๋ฆผ์ ์ค์ ๊ฐ์
|
170 |
this.body.traverse((child) => {
|
171 |
if (child.isMesh) {
|
172 |
child.castShadow = true;
|
173 |
child.receiveShadow = true;
|
174 |
+
child.material.shadowSide = THREE.BackSide;
|
175 |
+
child.material.needsUpdate = true;
|
176 |
}
|
177 |
});
|
178 |
|
|
|
180 |
if (child.isMesh) {
|
181 |
child.castShadow = true;
|
182 |
child.receiveShadow = true;
|
183 |
+
child.material.shadowSide = THREE.BackSide;
|
184 |
+
child.material.needsUpdate = true;
|
185 |
}
|
186 |
});
|
187 |
|
188 |
+
// ์ถ๊ฐ์ ์ธ ๊ทธ๋ฆผ์ ํ๋ฉด ์์ฑ
|
189 |
+
const shadowPlaneGeometry = new THREE.PlaneGeometry(8, 8);
|
190 |
+
const shadowPlaneMaterial = new THREE.ShadowMaterial({
|
191 |
+
opacity: 0.3
|
192 |
+
});
|
193 |
+
this.shadowPlane = new THREE.Mesh(shadowPlaneGeometry, shadowPlaneMaterial);
|
194 |
+
this.shadowPlane.receiveShadow = true;
|
195 |
+
this.shadowPlane.rotation.x = -Math.PI / 2;
|
196 |
+
this.shadowPlane.position.y = 0.1;
|
197 |
+
this.body.add(this.shadowPlane);
|
198 |
+
|
199 |
// ์ฌ๊ธฐ์ ์ ํจํ ์คํฐ ์์น๋ฅผ ์ฐพ์ ์ ์ฉ
|
200 |
if (window.gameInstance) {
|
201 |
const spawnPos = window.gameInstance.findValidSpawnPosition();
|