a3js 0.0.56 → 0.0.58
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 +6 -6
- package/dist/a3js.cjs.js.map +1 -1
- package/dist/a3js.es.js +31 -31
- package/dist/a3js.es.js.map +1 -1
- package/package.json +1 -1
package/dist/a3js.es.js
CHANGED
|
@@ -538,30 +538,30 @@ var rn = {
|
|
|
538
538
|
}
|
|
539
539
|
configColliderDescs() {
|
|
540
540
|
if (!this.objectA3) return;
|
|
541
|
-
let e = this.completeOptions, t = [];
|
|
542
|
-
this.objectA3.object3D.traverse((
|
|
543
|
-
if (Jt(
|
|
544
|
-
let
|
|
545
|
-
if (
|
|
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);
|
|
546
546
|
else {
|
|
547
547
|
let r, a;
|
|
548
548
|
switch (e.meshCollider) {
|
|
549
549
|
case "tri_mesh":
|
|
550
|
-
r = ln(
|
|
550
|
+
r = ln(i), a = dn(i.geometry);
|
|
551
551
|
break;
|
|
552
552
|
case "convex_hull":
|
|
553
|
-
r = un(
|
|
553
|
+
r = un(i), a = dn(i.geometry);
|
|
554
554
|
break;
|
|
555
555
|
}
|
|
556
|
-
r && (r.setCollisionGroups(
|
|
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));
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
});
|
|
560
|
-
let
|
|
561
|
-
for (let
|
|
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));
|
|
562
562
|
}
|
|
563
563
|
init(e, t) {
|
|
564
|
-
this.transform.set(e), this.objectA3 = t, this.colliderDescs = [], this.colliders = [], this.bodyDesc = this.makeBodyDesc(), this.configColliderDescs(), this.bodyDesc.setTranslation(e.loc.x, e.loc.y, e.loc.z), this.bodyDesc.setRotation(e.quat);
|
|
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);
|
|
565
565
|
}
|
|
566
566
|
addOneselfToPhysics(e) {
|
|
567
567
|
this.bodyDesc && (this.body = e.world.createRigidBody(this.bodyDesc), this.colliderDescs.forEach((t) => {
|
|
@@ -719,42 +719,42 @@ function dn(t) {
|
|
|
719
719
|
} else for (let e = 0; e < i.length; e += 9) o.set(i[e], i[e + 1], i[e + 2]), s.set(i[e + 3], i[e + 4], i[e + 5]), c.set(i[e + 6], i[e + 7], i[e + 8]), a += o.dot(s.clone().cross(c));
|
|
720
720
|
return Math.abs(a) / 6;
|
|
721
721
|
}
|
|
722
|
-
function fn(e) {
|
|
722
|
+
function fn(e, t = new V(1, 1, 1)) {
|
|
723
723
|
if (Yt(e)) {
|
|
724
|
-
let
|
|
724
|
+
let n = e.parameters, r = (typeof n?.width == "number" ? n.width / 2 : .5) * t.x, i = (typeof n?.height == "number" ? n.height / 2 : .5) * t.y, a = (typeof n?.depth == "number" ? n.depth / 2 : .5) * t.z, o = .1 * Math.cbrt(t.x * t.y * t.z);
|
|
725
725
|
return {
|
|
726
|
-
colliderDesc: G.ColliderDesc.roundCuboid(
|
|
727
|
-
volume: 2 *
|
|
726
|
+
colliderDesc: G.ColliderDesc.roundCuboid(r - o, i - o, a - o, o),
|
|
727
|
+
volume: 2 * r * 2 * i * 2 * a
|
|
728
728
|
};
|
|
729
729
|
} else if (Xt(e)) {
|
|
730
|
-
let
|
|
730
|
+
let n = e.parameters, r = (typeof n?.width == "number" ? n.width / 2 : .5) * t.x, i = (typeof n?.height == "number" ? n.height / 2 : .5) * t.y, a = (typeof n?.depth == "number" ? n.depth / 2 : .5) * t.z;
|
|
731
731
|
return {
|
|
732
|
-
colliderDesc: G.ColliderDesc.cuboid(
|
|
733
|
-
volume: 2 *
|
|
732
|
+
colliderDesc: G.ColliderDesc.cuboid(r, i, a),
|
|
733
|
+
volume: 2 * r * 2 * i * 2 * a
|
|
734
734
|
};
|
|
735
735
|
} else if (Zt(e)) {
|
|
736
|
-
let
|
|
736
|
+
let n = e.parameters, r = Math.cbrt(t.x * t.y * t.z), i = (typeof n?.radius == "number" ? n.radius : 1) * r;
|
|
737
737
|
return {
|
|
738
|
-
colliderDesc: G.ColliderDesc.ball(
|
|
739
|
-
volume: 4 / 3 * Math.PI *
|
|
738
|
+
colliderDesc: G.ColliderDesc.ball(i),
|
|
739
|
+
volume: 4 / 3 * Math.PI * i * i * i
|
|
740
740
|
};
|
|
741
741
|
} else if (Qt(e)) {
|
|
742
|
-
let
|
|
742
|
+
let n = e.parameters, r = Math.cbrt(t.x * t.y * t.z), i = (typeof n?.radius == "number" ? n.radius : 1) * r;
|
|
743
743
|
return {
|
|
744
|
-
colliderDesc: G.ColliderDesc.ball(
|
|
745
|
-
volume: 4 / 3 * Math.PI *
|
|
744
|
+
colliderDesc: G.ColliderDesc.ball(i),
|
|
745
|
+
volume: 4 / 3 * Math.PI * i * i * i
|
|
746
746
|
};
|
|
747
747
|
} else if ($t(e)) {
|
|
748
|
-
let
|
|
748
|
+
let n = e.parameters, r = Math.sqrt(t.x * t.z), i = (typeof n?.radiusBottom == "number" ? n.radiusBottom : .5) * r, a = (typeof n?.height == "number" ? n.height : .5) * t.y;
|
|
749
749
|
return {
|
|
750
|
-
colliderDesc: G.ColliderDesc.cylinder(
|
|
751
|
-
volume: Math.PI *
|
|
750
|
+
colliderDesc: G.ColliderDesc.cylinder(a / 2, i),
|
|
751
|
+
volume: Math.PI * i * i * a
|
|
752
752
|
};
|
|
753
753
|
} else if (en(e)) {
|
|
754
|
-
let
|
|
754
|
+
let n = e.parameters, r = Math.sqrt(t.x * t.z), i = (typeof n?.radius == "number" ? n.radius : .5) * r, a = (typeof n?.height == "number" ? n.height : .5) * t.y;
|
|
755
755
|
return {
|
|
756
|
-
colliderDesc: G.ColliderDesc.capsule(
|
|
757
|
-
volume: 4 / 3 * Math.PI *
|
|
756
|
+
colliderDesc: G.ColliderDesc.capsule(a / 2, i),
|
|
757
|
+
volume: 4 / 3 * Math.PI * i * i * i + Math.PI * i * i * a
|
|
758
758
|
};
|
|
759
759
|
}
|
|
760
760
|
return null;
|
|
@@ -12955,6 +12955,6 @@ var jo = {
|
|
|
12955
12955
|
};
|
|
12956
12956
|
customElements.define("ar-view-a3", Mo);
|
|
12957
12957
|
//#endregion
|
|
12958
|
-
export { Mo as ARView, Hr as Acerola3D, Mn as Action, Nn as ActionObject, Yr as AvatarPositionController, Zr as AvatarVelocityController, Kr as BaseController, Qr as BaseView, Ht as BillboardTransformer, mo as Box, Gr as Camera, Ka as Canvas, To as CarControl, Do as CarMotion, Eo as CarTransformer, Pr as ClipMotion, jt as DefaultTransformer, En as DynamicCharacterTransformer, Kt as FollowTransformer, Wa as GLTF, Co as GameCanvas, xo as Html3D, bo as ImagePlane, Cn as KinematicCharacterTransformer, q as ObjectA3, qr as OrbitController, H as Quat, on as RapierPhysicsEngine, sn as RapierPhysicsWorld, to as SampleObject, Wr as Scene, Wt as SmoothBillboardTransformer, Pt as SmoothTransformer, Lr as Sound, ho as Sphere, yo as StandardLights, Mt as StaticTransformer, fo as Text3D, $r as ThreeCamera, po as ThreeObject, W as Transform, Ao as VRView, V as Vec3, Xa as Window, Oo as XRCamera, hn as asyncSleep, an as collisionMap, xn as deepMerge, jo as defaultARViewOptions, Ga as defaultCanvasOptions, wo as defaultCarControlOptions, Tn as defaultDynamicCharacterTransformerOptions, Gt as defaultFollowTransformerOptions, So as defaultGameCanvasOptions, Sn as defaultKinematicCharacterTransformerOptions, eo as defaultSampleObjectOptions, An as defaultSetLightShadowOptions, Nt as defaultSmoothTransformerOptions, uo as defaultText3DOptions, ko as defaultVRViewOptions, Ya as defaultWindowOptions, Dt as
|
|
12958
|
+
export { Mo as ARView, Hr as Acerola3D, Mn as Action, Nn as ActionObject, Yr as AvatarPositionController, Zr as AvatarVelocityController, Kr as BaseController, Qr as BaseView, Ht as BillboardTransformer, mo as Box, Gr as Camera, Ka as Canvas, To as CarControl, Do as CarMotion, Eo as CarTransformer, Pr as ClipMotion, jt as DefaultTransformer, En as DynamicCharacterTransformer, Kt as FollowTransformer, Wa as GLTF, Co as GameCanvas, xo as Html3D, bo as ImagePlane, Cn as KinematicCharacterTransformer, q as ObjectA3, qr as OrbitController, H as Quat, on as RapierPhysicsEngine, sn as RapierPhysicsWorld, to as SampleObject, Wr as Scene, cn as SimplePhysicsTransformer, Wt as SmoothBillboardTransformer, Pt as SmoothTransformer, Lr as Sound, ho as Sphere, yo as StandardLights, Mt as StaticTransformer, fo as Text3D, $r as ThreeCamera, po as ThreeObject, W as Transform, Ao as VRView, V as Vec3, Xa as Window, Oo as XRCamera, hn as asyncSleep, an as collisionMap, xn as deepMerge, jo as defaultARViewOptions, Ga as defaultCanvasOptions, wo as defaultCarControlOptions, Tn as defaultDynamicCharacterTransformerOptions, Gt as defaultFollowTransformerOptions, So as defaultGameCanvasOptions, Sn as defaultKinematicCharacterTransformerOptions, eo as defaultSampleObjectOptions, An as defaultSetLightShadowOptions, rn as defaultSimplePhysicsOptions, Nt as defaultSmoothTransformerOptions, uo as defaultText3DOptions, ko as defaultVRViewOptions, Ya as defaultWindowOptions, Dt as eulerToQuat, Et as getLookAtQuat, lo as initFont, mn as initPhysics, Ir as initSound, At as quatToEuler, Ot as quatToMatrix, Va as recreateGLTFLoader };
|
|
12959
12959
|
|
|
12960
12960
|
//# sourceMappingURL=a3js.es.js.map
|