Skip to content

Commit

Permalink
Improve Smoke visuals a little
Browse files Browse the repository at this point in the history
  • Loading branch information
starswaitforus authored and solcloud committed Sep 14, 2024
1 parent f06f871 commit 28be7ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions www/assets/js/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ export class Game {

spawnSmoke(point, height, smokeId, partId) {
const size = this.#volumetrics[smokeId]['size']
const geo = new THREE.BoxGeometry(size, height, size)
const offset = Math.max(2, Math.ceil(size / 4));
const geo = new THREE.CylinderGeometry(size - randomInt(0, offset), size, height - randomInt(0, offset), randomInt(5, 22))
geo.translate(point.x, point.y + (geo.parameters.height / 2), -point.z)
this.#volumetrics[smokeId]['geometries'].push(geo)

Expand All @@ -356,7 +357,7 @@ export class Game {
}

let geometry = BufferGeometryUtils.mergeGeometries(this.#volumetrics[smokeId]['geometries'])
geometry = BufferGeometryUtils.mergeVertices(geometry, 2)
geometry = BufferGeometryUtils.mergeVertices(geometry, offset)
geometry.computeBoundingBox()
let mesh = this.#volumetrics[smokeId]['mesh']
if (mesh) {
Expand Down

0 comments on commit 28be7ef

Please sign in to comment.