a3js 0.0.58 → 0.0.60

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/a3js.es.js CHANGED
@@ -538,27 +538,27 @@ var rn = {
538
538
  }
539
539
  configColliderDescs() {
540
540
  if (!this.objectA3) return;
541
- let e = this.completeOptions, t = [], n = e.membership << 16 | e.filter, r = this.transform.scale;
542
- this.objectA3.object3D.traverse((i) => {
543
- if (Jt(i)) {
544
- let a = fn(i.geometry, r);
545
- if (a) a.colliderDesc.setCollisionGroups(n), e.collisionDetection && a.colliderDesc.setActiveEvents(G.ActiveEvents.COLLISION_EVENTS), this.colliderDescs.push(a.colliderDesc), a.colliderDesc.setRestitution(e.restitution).setFriction(e.friction), t.push(a.volume);
541
+ let e = this.completeOptions, t = [], n = this.transform.scale;
542
+ this.objectA3.object3D.traverse((r) => {
543
+ if (Jt(r)) {
544
+ let i = fn(r.geometry, n);
545
+ if (i) this.colliderDescs.push(i.colliderDesc), t.push(i.volume);
546
546
  else {
547
- let r, a;
547
+ let n, i;
548
548
  switch (e.meshCollider) {
549
549
  case "tri_mesh":
550
- r = ln(i), a = dn(i.geometry);
550
+ n = ln(r), i = dn(r.geometry);
551
551
  break;
552
552
  case "convex_hull":
553
- r = un(i), a = dn(i.geometry);
553
+ n = un(r), i = dn(r.geometry);
554
554
  break;
555
555
  }
556
- r && (r.setCollisionGroups(n), e.collisionDetection && r.setActiveEvents(G.ActiveEvents.COLLISION_EVENTS), r.setRestitution(e.restitution).setFriction(e.friction), this.colliderDescs.push(r), t.push(a));
556
+ n && (this.colliderDescs.push(n), t.push(i));
557
557
  }
558
558
  }
559
559
  });
560
- let i = t.reduce((e, t) => e + t, 0);
561
- for (let n = 0; n < this.colliderDescs.length; n++) this.colliderDescs[n].setRestitution(e.restitution), this.colliderDescs[n].setFriction(e.friction), this.colliderDescs[n].setMass(e.mass * (t[n] / i));
560
+ let r = t.reduce((e, t) => e + t, 0), i = e.membership << 16 | e.filter;
561
+ for (let n = 0; n < this.colliderDescs.length; n++) this.colliderDescs[n].setCollisionGroups(i), e.collisionDetection && (this.colliderDescs[n].setActiveEvents(G.ActiveEvents.COLLISION_EVENTS), e.rigidBody === "kinematic" && this.colliderDescs[n].setActiveCollisionTypes(G.ActiveCollisionTypes.DEFAULT | G.ActiveCollisionTypes.KINEMATIC_FIXED | G.ActiveCollisionTypes.KINEMATIC_KINEMATIC)), e.collider === "sensor" && this.colliderDescs[n].setSensor(!0), this.colliderDescs[n].setRestitution(e.restitution), this.colliderDescs[n].setFriction(e.friction), this.colliderDescs[n].setMass(e.mass * (t[n] / r));
562
562
  }
563
563
  init(e, t) {
564
564
  this.transform.set(e), this.objectA3 = t, this.colliderDescs = [], this.colliders = [], this.objectA3.object3D.scale.set(e.scale.x, e.scale.y, e.scale.z), this.bodyDesc = this.makeBodyDesc(), this.configColliderDescs(), this.bodyDesc.setTranslation(e.loc.x, e.loc.y, e.loc.z), this.bodyDesc.setRotation(e.quat);
@@ -8680,7 +8680,7 @@ var Wr = class {
8680
8680
  e.objectA.handleCollision(e.objectB, e.started, e.partOfA, e.partOfB), e.objectB.handleCollision(e.objectA, e.started, e.partOfB, e.partOfA);
8681
8681
  }), this.collisionListener && n.length > 0 && this.collisionListener(n), this.rapierLines && this.physicsWorld instanceof sn) {
8682
8682
  let { vertices: t, colors: n } = this.physicsWorld.world.debugRender();
8683
- this.rapierLines.geometry.setAttribute("position", new e.BufferAttribute(t, 3)), this.rapierLines.geometry.setAttribute("color", new e.BufferAttribute(n, 4));
8683
+ this.rapierLines.geometry.setAttribute("position", new e.BufferAttribute(t, 3)), this.rapierLines.geometry.setAttribute("color", new e.BufferAttribute(n, 4)), this.rapierLines.geometry.computeBoundingSphere();
8684
8684
  }
8685
8685
  }
8686
8686
  for (let e of this.objects) e.update(t);