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.cjs.js +2 -2
- package/dist/a3js.cjs.js.map +1 -1
- package/dist/a3js.es.js +12 -12
- package/dist/a3js.es.js.map +1 -1
- package/package.json +1 -1
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 =
|
|
542
|
-
this.objectA3.object3D.traverse((
|
|
543
|
-
if (Jt(
|
|
544
|
-
let
|
|
545
|
-
if (
|
|
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
|
|
547
|
+
let n, i;
|
|
548
548
|
switch (e.meshCollider) {
|
|
549
549
|
case "tri_mesh":
|
|
550
|
-
|
|
550
|
+
n = ln(r), i = dn(r.geometry);
|
|
551
551
|
break;
|
|
552
552
|
case "convex_hull":
|
|
553
|
-
|
|
553
|
+
n = un(r), i = dn(r.geometry);
|
|
554
554
|
break;
|
|
555
555
|
}
|
|
556
|
-
|
|
556
|
+
n && (this.colliderDescs.push(n), t.push(i));
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
});
|
|
560
|
-
let
|
|
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] /
|
|
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);
|