@adatechnology/game-destruction-three 1.1.2 → 1.2.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.js CHANGED
@@ -1073,6 +1073,7 @@ var FragmentSystem = class {
1073
1073
  dying: false,
1074
1074
  air: f.shape === "scrap" && sz[2] <= SHEET_MAX ? SHEET_AIR : 0,
1075
1075
  body: null,
1076
+ rigid: null,
1076
1077
  born: this.tick,
1077
1078
  life: lasting ? 0 : Math.max(0, typeof this.o.life === "function" ? this.o.life(f, home) : this.o.life),
1078
1079
  seq: this.nextSeq++,
@@ -1081,9 +1082,12 @@ var FragmentSystem = class {
1081
1082
  isMortal: false
1082
1083
  };
1083
1084
  if (lasting || isBig(f.size)) {
1085
+ const rigid = this.o.rigid;
1086
+ if (rigid) live.rigid = rigid.add(mesh, [sc.x / 2, sc.y / 2, sc.z / 2], f.mass, f.velocity, f.angularVelocity);
1084
1087
  live.body = {
1085
1088
  mass: f.mass,
1086
1089
  push: (x, z) => {
1090
+ if (rigid && live.rigid) return rigid.push(live.rigid, x, z);
1087
1091
  live.vel.x = x;
1088
1092
  live.vel.z = z;
1089
1093
  live.vel.y = Math.max(live.vel.y, 0.3);
@@ -1121,8 +1125,14 @@ var FragmentSystem = class {
1121
1125
  const k = (1 - dist / radius) ** 2 * speed;
1122
1126
  d.normalize().multiplyScalar(k);
1123
1127
  d.y += k * 0.4;
1128
+ const spin = this.w.set(this.rng() - 0.5, this.rng() - 0.5, this.rng() - 0.5).multiplyScalar(k);
1129
+ if (f.rigid) {
1130
+ spin.multiplyScalar(Math.min(1, TUMBLE_REACH / Math.max(f.half.x, f.half.y, f.half.z)));
1131
+ this.o.rigid?.shove(f.rigid, [d.x, d.y, d.z], [spin.x, spin.y, spin.z]);
1132
+ continue;
1133
+ }
1124
1134
  f.vel.add(d);
1125
- f.ang.add(this.w.set(this.rng() - 0.5, this.rng() - 0.5, this.rng() - 0.5).multiplyScalar(k));
1135
+ f.ang.add(spin);
1126
1136
  this.rouse(f);
1127
1137
  }
1128
1138
  }
@@ -1176,7 +1186,7 @@ var FragmentSystem = class {
1176
1186
  /** What lies inside the disc looks at the ground again: it was dug or heaped under it. */
1177
1187
  wakeRegion(x, z, radius) {
1178
1188
  for (const f of this.list) {
1179
- if (!f.asleep || Math.hypot(f.mesh.position.x - x, f.mesh.position.z - z) > radius) continue;
1189
+ if (!f.asleep || f.rigid || Math.hypot(f.mesh.position.x - x, f.mesh.position.z - z) > radius) continue;
1180
1190
  this.rouse(f);
1181
1191
  }
1182
1192
  }
@@ -1184,6 +1194,7 @@ var FragmentSystem = class {
1184
1194
  this.tick++;
1185
1195
  this.clock += dt;
1186
1196
  this.wakeUnsupported();
1197
+ this.wakeRigid();
1187
1198
  this.beginTick();
1188
1199
  const g = this.o.gravity;
1189
1200
  for (let i = this.active.length - 1; i >= 0; i--) {
@@ -1194,6 +1205,7 @@ var FragmentSystem = class {
1194
1205
  if (f.fade <= 0) {
1195
1206
  this.instances.remove(f.mesh);
1196
1207
  this.o.scene.remove(f.mesh);
1208
+ this.release(f);
1197
1209
  f.isActive = false;
1198
1210
  this.active.splice(i, 1);
1199
1211
  this.list.splice(this.list.indexOf(f), 1);
@@ -1202,19 +1214,34 @@ var FragmentSystem = class {
1202
1214
  f.mesh.scale.copy(f.baseScale).multiplyScalar(f.fade);
1203
1215
  }
1204
1216
  if (f.asleep) continue;
1205
- this.step(f, dt, g);
1217
+ if (f.rigid) this.follow(f);
1218
+ else this.step(f, dt, g);
1206
1219
  }
1207
1220
  this.expireSleepers();
1208
1221
  this.keepBudget();
1209
1222
  this.trail?.commit();
1210
1223
  this.drawInstanced();
1211
1224
  }
1225
+ /** Its body goes with it. */
1226
+ release(f) {
1227
+ if (f.rigid) this.o.rigid?.remove(f.rigid);
1228
+ f.rigid = null;
1229
+ }
1230
+ /** The debris moved by a rigid body that the body's world woke (something fell on it, a blast, its ground dug): it is awake here too. */
1231
+ wakeRigid() {
1232
+ for (const f of this.list) if (f.rigid && f.asleep && !f.dying && !f.rigid.sleeping) this.rouse(f);
1233
+ }
1234
+ /** A piece of debris moved by its rigid body: the body wrote its pose; it sleeps here when the body does. */
1235
+ follow(f) {
1236
+ f.box = void 0;
1237
+ if (f.rigid?.sleeping) this.sleep(f);
1238
+ }
1212
1239
  /** The meshes go back to the step's pose and the ones awake are recorded as the previous one (`interpolate`). */
1213
1240
  beginTick() {
1214
1241
  const trail = this.trail;
1215
1242
  if (!trail) return;
1216
1243
  trail.begin();
1217
- for (const f of this.active) if (!f.asleep) trail.record(f.mesh);
1244
+ for (const f of this.active) if (!f.asleep && !f.rigid) trail.record(f.mesh);
1218
1245
  }
1219
1246
  /** The meshes get the step pose back, before anything reads them. The instances take it at the next `update`. */
1220
1247
  restoreStepPose() {
@@ -1229,7 +1256,7 @@ var FragmentSystem = class {
1229
1256
  /** The fragments in flight are drawn by the instances, those at rest on their own (the settled batches take them): then the instances take the transforms of this update. */
1230
1257
  drawInstanced() {
1231
1258
  for (const f of this.active) {
1232
- if (f.asleep) this.instances.remove(f.mesh);
1259
+ if (f.asleep || f.rigid) this.instances.remove(f.mesh);
1233
1260
  else this.instances.add(f.mesh);
1234
1261
  }
1235
1262
  this.instances.sync();
@@ -1239,12 +1266,12 @@ var FragmentSystem = class {
1239
1266
  const most = this.o.maxAwake;
1240
1267
  if (most === void 0 || !Number.isFinite(most)) return;
1241
1268
  let awake = 0;
1242
- for (const f of this.active) if (!f.asleep && !f.dying) awake++;
1269
+ for (const f of this.active) if (!f.asleep && !f.dying && !f.rigid) awake++;
1243
1270
  if (awake <= most) return;
1244
1271
  for (let i = 0; i < this.active.length; i++) {
1245
1272
  const f = this.active[i];
1246
1273
  if (awake <= most) return;
1247
- if (f.asleep || f.dying || !f.contact || !isSlow(f)) continue;
1274
+ if (f.asleep || f.dying || f.rigid || !f.contact || !isSlow(f)) continue;
1248
1275
  this.sleep(f);
1249
1276
  i--;
1250
1277
  awake--;
@@ -1276,7 +1303,7 @@ var FragmentSystem = class {
1276
1303
  for (let k = 0; k < Math.min(SUPPORT_CHECKS, n); k++) {
1277
1304
  this.supportTurn = (this.supportTurn + 1) % n;
1278
1305
  const f = this.list[this.supportTurn];
1279
- if (!f.asleep || f.dying) continue;
1306
+ if (!f.asleep || f.dying || f.rigid) continue;
1280
1307
  const e = this.m.makeRotationFromQuaternion(f.mesh.quaternion).elements;
1281
1308
  const ext = Math.abs(e[1]) * f.half.x + Math.abs(e[5]) * f.half.y + Math.abs(e[9]) * f.half.z;
1282
1309
  f.floor = null;
@@ -1462,6 +1489,7 @@ var FragmentSystem = class {
1462
1489
  if (this.list[i].home === home) {
1463
1490
  this.instances.remove(this.list[i].mesh);
1464
1491
  this.o.scene.remove(this.list[i].mesh);
1492
+ this.release(this.list[i]);
1465
1493
  this.deactivate(this.list[i]);
1466
1494
  this.list[i].deadline = Infinity;
1467
1495
  this.list.splice(i, 1);
@@ -1471,7 +1499,10 @@ var FragmentSystem = class {
1471
1499
  clear() {
1472
1500
  this.trail?.clear();
1473
1501
  this.instances.clear();
1474
- for (const f of this.list) this.o.scene.remove(f.mesh);
1502
+ for (const f of this.list) {
1503
+ this.o.scene.remove(f.mesh);
1504
+ this.release(f);
1505
+ }
1475
1506
  this.list.length = 0;
1476
1507
  this.active.length = 0;
1477
1508
  this.mortal.length = 0;
@@ -3388,7 +3419,7 @@ var DEFAULT_MIN_IMPULSE = 30;
3388
3419
  var DEFAULT_HITS_MAX = 32;
3389
3420
  var DEFAULT_MIN_APPROACH = 1.5;
3390
3421
  var DEFAULT_CONTACT_RADIUS = 0.1;
3391
- var createEngineImpacts = (loop, statics, destruction, options = {}) => {
3422
+ var createEngineImpacts = (loop, statics, destruction, options = {}, isDebris) => {
3392
3423
  const hitsMax = options.hitsMax ?? DEFAULT_HITS_MAX;
3393
3424
  const radius = options.contactRadius ?? DEFAULT_CONTACT_RADIUS;
3394
3425
  const minApproach = options.minApproach ?? DEFAULT_MIN_APPROACH;
@@ -3396,8 +3427,11 @@ var createEngineImpacts = (loop, statics, destruction, options = {}) => {
3396
3427
  minImpulse: options.minImpulse ?? DEFAULT_MIN_IMPULSE,
3397
3428
  bodiesMax: hitsMax,
3398
3429
  accepts: (body) => statics.ownerOf.has(body),
3430
+ // what is left of a part that broke breaks nothing again when it lands: a blow of debris is no blow to the world
3431
+ ...isDebris ? { ignores: isDebris } : {},
3399
3432
  onImpact: (impact2) => {
3400
3433
  if (impact2.approach < minApproach) return;
3434
+ if (options.harmless?.(impact2.other)) return;
3401
3435
  const object = statics.ownerOf.get(impact2.body);
3402
3436
  const part = statics.partOf.get(impact2.body);
3403
3437
  if (object === void 0 || part === void 0 || destruction.part(object, part) === null) return;
@@ -3855,6 +3889,7 @@ var WAKE_MARGIN2 = 0.1;
3855
3889
  var NO_PROGRESS = 0.75;
3856
3890
  var WAY_STEP_MIN = 0.02;
3857
3891
  var WAY_STEP_MAX = 0.1;
3892
+ var BORN_INSIDE = { layers: ["static", "rubble"] };
3858
3893
  var EnginePieces = class {
3859
3894
  constructor(THREE, world, o) {
3860
3895
  __publicField(this, "world", world);
@@ -3897,6 +3932,12 @@ var EnginePieces = class {
3897
3932
  __publicField(this, "blasts", []);
3898
3933
  /** The host's fixed things (`staticSolids`) as static bodies. */
3899
3934
  __publicField(this, "statics");
3935
+ /** The debris still passing through a fixed thing it was made inside (`throughStatics`). */
3936
+ __publicField(this, "passing", /* @__PURE__ */ new Set());
3937
+ /** A set of one fixed body, to ask how deep a piece is in that one. */
3938
+ __publicField(this, "oneStatic", /* @__PURE__ */ new Set());
3939
+ /** The bodies a piece of debris overlaps where it is made (`throughStatics`), kept between asks. */
3940
+ __publicField(this, "overlapped", []);
3900
3941
  __publicField(this, "ignored", /* @__PURE__ */ new Set());
3901
3942
  __publicField(this, "knocks", /* @__PURE__ */ new Map());
3902
3943
  __publicField(this, "footprintOut", { corners: new Float64Array(16), normals: new Float64Array(6), minX: 0, maxX: 0, minZ: 0, maxZ: 0 });
@@ -4001,6 +4042,7 @@ var EnginePieces = class {
4001
4042
  this.byUser.delete(link.user);
4002
4043
  this.byBody.delete(link.id);
4003
4044
  this.bodyIds.delete(link.id);
4045
+ this.passing.delete(b);
4004
4046
  this.active.delete(b);
4005
4047
  if (this.byObject.get(b.objectId) === b) this.byObject.delete(b.objectId);
4006
4048
  this.links.delete(b);
@@ -4141,6 +4183,7 @@ var EnginePieces = class {
4141
4183
  this.makeBodies(each);
4142
4184
  each((b) => this.hang(b));
4143
4185
  each((b) => this.sync(b, dt, h));
4186
+ this.meetStaticsAgain();
4144
4187
  if (this.schedule) this.layGroundLater(each, dt);
4145
4188
  else this.layGround(each, dt);
4146
4189
  this.keepApart(apart2);
@@ -4414,7 +4457,8 @@ var EnginePieces = class {
4414
4457
  this.byBody.set(id, b);
4415
4458
  this.bodyIds.add(id);
4416
4459
  this.byObject.set(b.objectId, b);
4417
- this.outOfStatics(b, link);
4460
+ if (b.debris) this.throughStatics(b, link);
4461
+ else this.outOfStatics(b, link);
4418
4462
  });
4419
4463
  }
4420
4464
  bodyDesc(b, user) {
@@ -4431,7 +4475,7 @@ var EnginePieces = class {
4431
4475
  centreAtOrigin: true,
4432
4476
  keepPartContacts: shape.kind === "compound" && shape.children.length > 1,
4433
4477
  material: this.material(b),
4434
- layer: "debris",
4478
+ layer: b.debris ? "rubble" : "debris",
4435
4479
  // no air drag: the kit's pieces never had any (a round piece's rolling resistance is the adapter's, `rolling`)
4436
4480
  angularDamping: 0,
4437
4481
  linearDamping: 0,
@@ -4495,6 +4539,52 @@ var EnginePieces = class {
4495
4539
  * lifted (`underGround`). Left to the engine it is pushed out a little each step (`maxPushOut`), which reads as the piece rising by itself: a roof sheet made 1 m
4496
4540
  * into a shelf rose 0.83-0.94 m over the room's 11 s. Only past a contact's sink (`SINK`): resting on a shelf it is not moved.
4497
4541
  */
4542
+ /**
4543
+ * A piece of debris made inside something (the bars of a cage that gave way, inside the wall that still stands; a chunk overlapping the part next to the one that broke,
4544
+ * or the chunk cut beside it) is not moved out of it as a piece is (`outOfStatics`), and the engine does not push the two apart: debris is born
4545
+ * where the thing broke. It passes through what it was made inside until it is out of it, and only through that.
4546
+ */
4547
+ throughStatics(b, link) {
4548
+ const q = b.root.quaternion;
4549
+ const c = this.centre(b);
4550
+ const found = this.overlapped;
4551
+ this.world.overlapShape(this.shapeOf(b), [c.x, c.y, c.z], [q.x, q.y, q.z, q.w], found, BORN_INSIDE);
4552
+ for (const id of found) {
4553
+ if (id === link.id || link.through?.includes(id) || !(this.statics.ids.has(id) || this.bodyIds.has(id))) continue;
4554
+ this.world.ignorePair(link.id, id, true);
4555
+ (link.through ?? (link.through = [])).push(id);
4556
+ }
4557
+ if (link.through?.length) this.passing.add(b);
4558
+ }
4559
+ /** The debris passing through what it was made inside meets it again once it is out of it; what was made again meanwhile (a fixed thing's body is a new one) is looked at afresh. */
4560
+ meetStaticsAgain() {
4561
+ if (this.passing.size === 0 || !this.world.penetration) return;
4562
+ const one = this.oneStatic;
4563
+ for (const b of this.passing) {
4564
+ const link = this.links.get(b);
4565
+ const through = link?.through;
4566
+ if (!link || !through) {
4567
+ this.passing.delete(b);
4568
+ continue;
4569
+ }
4570
+ let remade = false;
4571
+ for (let i = through.length - 1; i >= 0; i--) {
4572
+ const id = through[i];
4573
+ if (!this.statics.ids.has(id) && !this.bodyIds.has(id)) {
4574
+ remade = true;
4575
+ through.splice(i, 1);
4576
+ continue;
4577
+ }
4578
+ one.clear();
4579
+ one.add(id);
4580
+ if (this.world.penetration(link.id, this.outAxis, one) > SINK) continue;
4581
+ this.world.ignorePair(link.id, id, false);
4582
+ through.splice(i, 1);
4583
+ }
4584
+ if (remade) this.throughStatics(b, link);
4585
+ if (through.length === 0) this.passing.delete(b);
4586
+ }
4587
+ }
4498
4588
  outOfStatics(b, link) {
4499
4589
  if (!this.world.penetration) return;
4500
4590
  const axis = this.outAxis;
@@ -5509,7 +5599,7 @@ var PieceSystem = class {
5509
5599
  }
5510
5600
  /** Contact blows on the fixed parts become `blunt` hits of `destruction` (`engine-impacts.ts`). Returns the way to stop it. */
5511
5601
  contactHits(destruction, options) {
5512
- return createEngineImpacts(this.loop, this.engine.statics, destruction, options);
5602
+ return createEngineImpacts(this.loop, this.engine.statics, destruction, options, (body) => this.engine.pieceOfBody(body)?.debris === true);
5513
5603
  }
5514
5604
  /**
5515
5605
  * The pieces a blast at `point` can reach: the bodies the engine's `blastQuery` finds within `radius` (the pieces among them), in the order of `list`, and the pieces that have no
@@ -6178,13 +6268,13 @@ var PieceSystem = class {
6178
6268
  if (most === void 0 || !Number.isFinite(most)) return;
6179
6269
  let awake = 0;
6180
6270
  for (const b of this.list) {
6181
- if (b.sleeping || b.held) continue;
6271
+ if (b.sleeping || b.held || b.debris) continue;
6182
6272
  if (this.hasComeToRest(b) && (b.balancing || b.still >= SLEEP_AFTER && !b.hinge && !this.onSteepSupport(b))) this.sleepByBudget(b);
6183
6273
  else awake++;
6184
6274
  }
6185
6275
  for (const b of this.list) {
6186
6276
  if (awake <= most) return;
6187
- if (b.sleeping || b.held || !this.hasComeToRest(b)) continue;
6277
+ if (b.sleeping || b.held || b.debris || !this.hasComeToRest(b)) continue;
6188
6278
  this.sleepByBudget(b);
6189
6279
  awake--;
6190
6280
  }
@@ -6203,12 +6293,13 @@ var PieceSystem = class {
6203
6293
  const c = this.centerOf(b, this.p);
6204
6294
  return Math.hypot(c.x - focus[0], c.y - focus[1], c.z - focus[2]) > keep.far.distance;
6205
6295
  };
6206
- const atRest = this.list.filter((b) => !b.held && this.hasComeToRest(b));
6296
+ const pieces = this.list.filter((b) => !b.debris);
6297
+ const atRest = pieces.filter((b) => !b.held && this.hasComeToRest(b));
6207
6298
  if (keep.far.action === "sleep") {
6208
6299
  for (const b of atRest) if (!b.sleeping && isFarAndOld(b)) this.sleepByBudget(b);
6209
6300
  }
6210
6301
  const fades = keep.far.action === "fade";
6211
- let over2 = this.list.length - keep.maxLive;
6302
+ let over2 = pieces.length - keep.maxLive;
6212
6303
  const far2 = new Set(atRest.filter(isFarAndOld));
6213
6304
  for (const b of [...atRest].sort((a, c) => Number(far2.has(c)) - Number(far2.has(a)))) {
6214
6305
  if (!(over2 > 0 || fades && far2.has(b))) return;
@@ -8745,6 +8836,7 @@ var UNDERMINED_STAND = 0.4;
8745
8836
  var UNDERMINED_KEEP = 0.6;
8746
8837
  var SOLIDS_MAX = 64;
8747
8838
  var UNDERMINED_PUSH = 0.6;
8839
+ var DEBRIS_ID = "debris#";
8748
8840
  var UNDERMINED_STILL = 0.05;
8749
8841
  var SOLID_WELD = 1e-4;
8750
8842
  var UNCHECKED_KINDS = /* @__PURE__ */ new Set(["structure", "room", "ground"]);
@@ -8978,6 +9070,8 @@ var Renderer = class {
8978
9070
  /** The parts the ground went down under, drawn going down (`subside`). */
8979
9071
  __publicField(this, "settlement");
8980
9072
  __publicField(this, "fragments");
9073
+ /** Count of the bodies made for big debris: each gets an id of its own. */
9074
+ __publicField(this, "debrisMade", 0);
8981
9075
  __publicField(this, "ground");
8982
9076
  __publicField(this, "pieceSys");
8983
9077
  __publicField(this, "cages");
@@ -9064,7 +9158,34 @@ var Renderer = class {
9064
9158
  // and it meets the walls, ceilings and furniture on its way: it stops on their face instead of flying into them
9065
9159
  sweep: (from, direction, distance) => typeof this.world.raycast === "function" ? this.world.raycast([from[0], from[1], from[2]], [direction[0], direction[1], direction[2]], distance) : null,
9066
9160
  maxAwake: o.maxAwakeFragments ?? Infinity,
9067
- ...o.interpolate ? { interpolate: true } : {}
9161
+ ...o.interpolate ? { interpolate: true } : {},
9162
+ rigid: {
9163
+ add: (mesh, half, mass, velocity, angular) => {
9164
+ const body = this.pieceSys.create(`${DEBRIS_ID}${++this.debrisMade}`, mesh, [half[0], half[1], half[2]], new THREE.Vector3(), mass, [velocity[0], velocity[1], velocity[2]], [angular[0], angular[1], angular[2]]);
9165
+ body.debris = true;
9166
+ return body;
9167
+ },
9168
+ remove: (handle) => this.pieceSys.remove(handle.objectId),
9169
+ push: (handle, x, z) => {
9170
+ const body = handle;
9171
+ body.velocity[0] = x;
9172
+ body.velocity[2] = z;
9173
+ body.velocity[1] = Math.max(body.velocity[1], 0.3);
9174
+ body.sleeping = false;
9175
+ body.still = 0;
9176
+ body.calmAt = null;
9177
+ },
9178
+ shove: (handle, velocity, spin) => {
9179
+ const body = handle;
9180
+ for (let i = 0; i < 3; i++) {
9181
+ body.velocity[i] = body.velocity[i] + velocity[i];
9182
+ body.angularVelocity[i] = body.angularVelocity[i] + spin[i];
9183
+ }
9184
+ body.sleeping = false;
9185
+ body.still = 0;
9186
+ body.calmAt = null;
9187
+ }
9188
+ }
9068
9189
  });
9069
9190
  this.cages = new RebarCages(THREE, o.scene);
9070
9191
  this.settledBatches = new SettledBatches(THREE, o.scene, o.settledBatches ?? { enabled: false });
@@ -9536,10 +9657,11 @@ var Renderer = class {
9536
9657
  return shape === 0 ? 1 : drawn / shape;
9537
9658
  }
9538
9659
  pieces() {
9539
- return [...this.pieceSys.list];
9660
+ return this.pieceSys.list.filter((piece) => !piece.debris);
9540
9661
  }
9541
9662
  piece(objectId) {
9542
- return this.pieceSys.get(objectId);
9663
+ const piece = this.pieceSys.get(objectId);
9664
+ return piece && !piece.debris ? piece : null;
9543
9665
  }
9544
9666
  impulse(objectId, impulse, point) {
9545
9667
  const p = this.pieceSys.get(objectId);
@@ -9567,6 +9689,7 @@ var Renderer = class {
9567
9689
  }
9568
9690
  /** A piece thrown into a wall: the wall takes the blow of its weight where it met it, the piece takes it too, and each sounds as its material does. */
9569
9691
  slam(p, hit, speed) {
9692
+ if (p.debris) return;
9570
9693
  const energy = 0.5 * p.mass * speed * speed;
9571
9694
  const direction = [-hit.normal[0], -hit.normal[1], -hit.normal[2]];
9572
9695
  this.landingSound(hit.object, hit.point, clamp(speed / 10, 0.2, 1));
@@ -9578,6 +9701,7 @@ var Renderer = class {
9578
9701
  }
9579
9702
  }
9580
9703
  hardLanding(p, point, speed) {
9704
+ if (p.debris) return;
9581
9705
  this.landingSound(p.objectId, point, clamp(speed / 10, 0.2, 1));
9582
9706
  this.syncBound(p.objectId);
9583
9707
  try {
@@ -10186,7 +10310,7 @@ var Renderer = class {
10186
10310
  for (const [id, a] of this.staticNow()) scan(a, id, null, 6);
10187
10311
  const c = this.v1;
10188
10312
  for (const pc of this.pieceSys.list) {
10189
- if (pc.held) continue;
10313
+ if (pc.held || pc.debris) continue;
10190
10314
  this.pieceSys.centerOf(pc, c);
10191
10315
  const reach = Math.hypot(pc.halfExtents[0], pc.halfExtents[1], pc.halfExtents[2]) + radius;
10192
10316
  if (Math.abs(c.x - x) > reach || Math.abs(c.z - z) > reach) continue;
@@ -11755,7 +11879,7 @@ var Renderer = class {
11755
11879
  reach(distance, { objectId: pc.objectId, generation: pc.generation, impulse, point }, [c.x, c.y, c.z]);
11756
11880
  };
11757
11881
  const reached = this.o.blastQuery ? this.pieceSys.piecesInBlast(this.o.blastQuery, p, ev.radius) : [...this.pieceSys.list];
11758
- for (const pc of reached) shove(pc);
11882
+ for (const pc of reached) if (!pc.debris) shove(pc);
11759
11883
  if (this.o.shoveable) this.loosen(p, ev.radius, energy, reachOf2, policy, reach);
11760
11884
  this.advanceWakes(0);
11761
11885
  this.fragments.blast(p, ev.radius, Math.min(20, Math.sqrt(energy) * 0.08));
@@ -11823,6 +11947,7 @@ var Renderer = class {
11823
11947
  if (centre.distanceTo(point) <= ev.radius) cover.set(objectId, reach.call(this.world, ev.point, [centre.x, centre.y, centre.z], { ignore: [ev.object, objectId] }));
11824
11948
  };
11825
11949
  for (const pc of this.pieceSys.list) {
11950
+ if (pc.debris) continue;
11826
11951
  this.pieceSys.centerOf(pc, centre);
11827
11952
  read(pc.objectId);
11828
11953
  }