@adatechnology/game-destruction-three 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -1
- package/dist/index.global.js +12 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2558,6 +2558,9 @@ var Renderer = class {
|
|
|
2558
2558
|
if (options.visual !== false) this.playExplosion(ev, options);
|
|
2559
2559
|
this.vfx.push(p, ev.radius, 4);
|
|
2560
2560
|
const c = this.v1;
|
|
2561
|
+
const report = options.report;
|
|
2562
|
+
const confinement = report?.find((r) => r.blast !== void 0)?.blast?.confinement ?? 1;
|
|
2563
|
+
const energy = ev.energy * confinement;
|
|
2561
2564
|
for (const pc of this.pieceSys.list) {
|
|
2562
2565
|
this.pieceSys.centerOf(pc, c);
|
|
2563
2566
|
const dx = c.x - p[0];
|
|
@@ -2566,13 +2569,14 @@ var Renderer = class {
|
|
|
2566
2569
|
const d = Math.hypot(dx, dy, dz);
|
|
2567
2570
|
if (d > ev.radius) continue;
|
|
2568
2571
|
const fall = (1 - d / ev.radius) ** 2;
|
|
2569
|
-
const
|
|
2572
|
+
const reach = report?.find((r) => r.object === pc.objectId)?.blast?.shelter ?? 1;
|
|
2573
|
+
const speed = Math.min(30, Math.sqrt(2 * energy * reach * 0.02 / pc.mass)) * fall;
|
|
2570
2574
|
const inv = d > 1e-4 ? 1 / d : 0;
|
|
2571
2575
|
const dir = d > 1e-4 ? [dx * inv, dy * inv + 0.3, dz * inv] : [0, 1, 0];
|
|
2572
2576
|
const spread = pc.halfExtents[0];
|
|
2573
2577
|
this.pieceSys.impulse(pc, [dir[0] * speed * pc.mass, dir[1] * speed * pc.mass, dir[2] * speed * pc.mass], [c.x + (this.rng() - 0.5) * spread, c.y + spread * 0.5, c.z + (this.rng() - 0.5) * spread]);
|
|
2574
2578
|
}
|
|
2575
|
-
this.fragments.blast(p, ev.radius, Math.min(20, Math.sqrt(
|
|
2579
|
+
this.fragments.blast(p, ev.radius, Math.min(20, Math.sqrt(energy) * 0.08));
|
|
2576
2580
|
this.sound("explode", p, clamp(0.5 + ev.radius / 10, 0.5, 1));
|
|
2577
2581
|
}
|
|
2578
2582
|
playExplosion(ev, options) {
|