Spaces:
Running
Running
cutechicken
commited on
Commit
β’
3132a78
1
Parent(s):
57e9535
Update game.js
Browse files
game.js
CHANGED
@@ -327,10 +327,10 @@ class Game {
|
|
327 |
async initialize() {
|
328 |
try {
|
329 |
// μκ° ν¨κ³Ό μ‘°μ
|
330 |
-
this.scene.fog = new THREE.Fog(0xC2B280,
|
331 |
this.scene.background = new THREE.Color(0x87CEEB); // νλμ λ°°κ²½
|
332 |
|
333 |
-
const ambientLight = new THREE.AmbientLight(0xffffff, 0
|
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
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
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 |
}
|