From 688a3e5a1e733d7457b8a9c597b3da36866f14ff Mon Sep 17 00:00:00 2001 From: Daniel Maixner Date: Fri, 23 Dec 2022 17:34:24 +0100 Subject: [PATCH] Tuning --- www/assets/js/Game.js | 2 +- www/assets/js/ModelRepository.js | 29 +++++++++++++---------------- www/assets/js/World.js | 1 + 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/www/assets/js/Game.js b/www/assets/js/Game.js index 6d4fb4d..26255e5 100644 --- a/www/assets/js/Game.js +++ b/www/assets/js/Game.js @@ -144,7 +144,7 @@ export class Game { if (data.player) { this.playerHit(data.player, data.position, data.extra, false) } else if (data.surface && (data.item.slot === InventorySlot.SLOT_PRIMARY || data.item.slot === InventorySlot.SLOT_SECONDARY)) { - this.#world.bulletWallHit(data.position, data.surface, (data.item.slot === InventorySlot.SLOT_PRIMARY ? 1.2 : 0.8)) + this.#world.bulletWallHit(data.position, data.surface, (data.item.slot === InventorySlot.SLOT_PRIMARY ? 1.5 : 1.1)) } } else if (data.type === SoundType.BULLET_HIT_HEADSHOT) { this.playerHit(data.player, data.position, data.extra, true) diff --git a/www/assets/js/ModelRepository.js b/www/assets/js/ModelRepository.js index 1d70bbc..593988a 100644 --- a/www/assets/js/ModelRepository.js +++ b/www/assets/js/ModelRepository.js @@ -47,13 +47,14 @@ export class ModelRepository { const sun = new THREE.DirectionalLight(0xffeac2, .9) sun.position.set(4000, 4999, -4000) sun.castShadow = true - sun.shadow.mapSize.width = 512 - sun.shadow.mapSize.height = 512 - sun.shadow.camera.far = 20000 - sun.shadow.camera.left = -20000 - sun.shadow.camera.right = 20000 - sun.shadow.camera.top = 20000 - sun.shadow.camera.bottom = -20000 + //sun.shadow.bias = .0001 + sun.shadow.mapSize.width = 4096 + sun.shadow.mapSize.height = 4096 + sun.shadow.camera.far = 10000 + sun.shadow.camera.left = -2000 + sun.shadow.camera.right = 2000 + sun.shadow.camera.top = 0 + sun.shadow.camera.bottom = -3000 model.scene.add(sun, new THREE.AmbientLight(0xcfe4bb, .4)) return model.scene }) @@ -96,7 +97,7 @@ export class ModelRepository { const model = this.#models[item.id] if (model === undefined) { console.warn("No model for", item) - return new THREE.Mesh(new THREE.SphereGeometry(10), new THREE.MeshBasicMaterial({color: 0xFF0000})) + return new THREE.Mesh(new THREE.SphereGeometry(8), new THREE.MeshBasicMaterial({color: 0xFF0000})) } return model.clone() @@ -128,22 +129,20 @@ export class ModelRepository { this.#models[ItemId.Bomb] = model.scene })) promises.push(this.#loadModel('./resources/model/knife.glb').then((model) => { - model.scene.scale.set(-400, 400, 400) + model.scene.scale.set(-500, 500, 500) model.scene.traverse(function (object) { if (object.isMesh) { object.castShadow = true - object.receiveShadow = true } }) this.#models[ItemId.Knife] = model.scene })) promises.push(this.#loadModel('./resources/model/pistol.glb').then((model) => { - model.scene.scale.set(10, 10, 10) + model.scene.scale.set(15, 15, 15) model.scene.traverse(function (object) { if (object.isMesh) { object.castShadow = true - object.receiveShadow = true } }) @@ -152,11 +151,10 @@ export class ModelRepository { this.#models[ItemId.PistolGlock] = model.scene })) promises.push(this.#loadModel('./resources/model/ak.glb').then((model) => { - model.scene.scale.set(10, 10, 10) + model.scene.scale.set(15, 15, 15) model.scene.traverse(function (object) { if (object.isMesh) { object.castShadow = true - object.receiveShadow = true } }) @@ -167,7 +165,6 @@ export class ModelRepository { model.scene.traverse(function (object) { if (object.isMesh) { object.castShadow = true - object.receiveShadow = true } }) @@ -211,7 +208,7 @@ export class ModelRepository { transparent: true, }); const sprite = new THREE.Sprite(material); - sprite.scale.set(20, 20, 1); + sprite.scale.set(30, 30, 1); this.#meshes.playerHitMesh = sprite })) diff --git a/www/assets/js/World.js b/www/assets/js/World.js index d8b0be3..d2db5cd 100644 --- a/www/assets/js/World.js +++ b/www/assets/js/World.js @@ -33,6 +33,7 @@ export class World { const listener = new THREE.AudioListener() const povItem = new THREE.Group() povItem.name = 'pov-item' + povItem.scale.setScalar(.7) povItem.position.x = 4 povItem.position.z = -28 povItem.position.y = -14