a3js 0.0.42 → 0.0.44
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 +8 -10
- package/dist/a3js.es.js.map +1 -1
- package/package.json +1 -1
package/dist/a3js.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ir=Object.create;var vn=Object.defineProperty;var br=Object.getOwnPropertyDescriptor;var Cr=Object.getOwnPropertyNames;var yr=Object.getPrototypeOf,Br=Object.prototype.hasOwnProperty;var Tr=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Cr(e))!Br.call(i,r)&&r!==t&&vn(i,r,{get:()=>e[r],enumerable:!(n=br(e,r))||n.enumerable});return i};var wr=(i,e,t)=>(t=i!=null?Ir(yr(i)):{},Tr(e||!i||!i.__esModule?vn(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("three"),Kn=require("fflate");function Rr(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const oe=Rr(E);class Ae{x=0;y=0;z=0;constructor(e,t,n){typeof e=="number"?(this.x=e,this.y=t,this.z=n):typeof e>"u"?this.x=this.y=this.z=0:(this.x=e.x,this.y=e.y,this.z=e.z)}clone(){return new Ae(this)}write(e){e.x=this.x,e.y=this.y,e.z=this.z}normalize(){const e=this.x*this.x+this.y*this.y+this.z*this.z,t=Math.sqrt(e);return t!==0?(this.x/=t,this.y/=t,this.z/=t):console.warn("Vec3.normalize."),this}negate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}set(e,t,n){return typeof e=="number"?(this.x=e,this.y=t,this.z=n):(this.x=e.x,this.y=e.y,this.z=e.z),this}add(e,t,n){return typeof e=="number"?(this.x+=e,this.y+=t,this.z+=n):(this.x+=e.x,this.y+=e.y,this.z+=e.z),this}sub(e,t,n){return typeof e=="number"?(this.x-=e,this.y-=t,this.z-=n):(this.x-=e.x,this.y-=e.y,this.z-=e.z),this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}cross(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this}apply(e,t,n,r){let o,s,c,A;typeof e=="number"?(o=e,s=t,c=n,A=r):(o=e.x,s=e.y,c=e.z,A=e.w);const a=2*(s*this.z-c*this.y),d=2*(c*this.x-o*this.z),u=2*(o*this.y-s*this.x);return this.x+=A*a+s*u-c*d,this.y+=A*d+c*a-o*u,this.z+=A*u+o*d-s*a,this}lerp(e,t,n){this.x=(1-n)*e.x+n*t.x,this.y=(1-n)*e.y+n*t.y,this.z=(1-n)*e.z+n*t.z}}class Me{x=0;y=0;z=0;w=1;constructor(e,t,n,r){typeof e=="number"?(this.x=e,this.y=t,this.z=n,this.w=r):typeof e>"u"?(this.x=this.y=this.z=0,this.w=1):(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w)}clone(){return new Me(this)}write(e){e.x=this.x,e.y=this.y,e.z=this.z,e.w=this.w}normalize(){const e=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w,t=Math.sqrt(e);return t!==0?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):console.warn("Quat.normalize."),this}conjugate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}set(e,t,n,r){return typeof e=="number"?(this.x=e,this.y=t,this.z=n,this.w=r):(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w),this}mul(e,t,n,r){const o=this.x,s=this.y,c=this.z,A=this.w;let a,d,u,m;return typeof e=="number"?(a=e,d=t,u=n,m=r):(a=e.x,d=e.y,u=e.z,m=e.w),this.x=A*a+o*m+s*u-c*d,this.y=A*d-o*u+s*m+c*a,this.z=A*u+o*d-s*a+c*m,this.w=A*m-o*a-s*d-c*u,this}lerp(e,t,n){this.x=(1-n)*e.x+n*t.x,this.y=(1-n)*e.y+n*t.y,this.z=(1-n)*e.z+n*t.z,this.w=(1-n)*e.w+n*t.w}slerp(e,t,n){if(n<0||n>1){console.warn("Quat.slerp(): t must be in [0,1]");return}let r=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(Xe.set(t),r<0&&(r*=-1,Xe.set(-Xe.x,-Xe.y,-Xe.z,-Xe.w)),r>.9995){this.x=(1-n)*e.x+n*Xe.x,this.y=(1-n)*e.y+n*Xe.y,this.z=(1-n)*e.z+n*Xe.z,this.w=(1-n)*e.w+n*Xe.w;const o=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);o<1e-4?(console.warn("Quat.slerp(); ???!"),this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):(this.x*=1/o,this.y*=1/o,this.z*=1/o,this.w*=1/o)}else{const o=Math.acos(r),s=Math.sin((1-n)*o)/Math.sin(o),c=Math.sin(n*o)/Math.sin(o);this.x=s*e.x+c*Xe.x,this.y=s*e.y+c*Xe.y,this.z=s*e.z+c*Xe.z,this.w=s*e.w+c*Xe.w}}}const Xe=new Me;function At(i,e,t,n){t.normalize();const r=i.clone().sub(e).normalize(),o=new Ae().cross(r,t).normalize(),s=new Ae().cross(o,r),c=o.x,A=s.x,a=-r.x,d=o.y,u=s.y,m=-r.y,p=o.z,I=s.z,g=-r.z;let l,h,f,C;const b=c+u+g;if(b>0){const R=Math.sqrt(b+1)*2;l=(I-m)/R,h=(a-p)/R,f=(d-A)/R,C=.25*R}else if(c>u&&c>g){const R=Math.sqrt(1+c-u-g)*2;l=.25*R,h=(A+d)/R,f=(a+p)/R,C=(I-m)/R}else if(u>g){const R=Math.sqrt(1+u-c-g)*2;l=(A+d)/R,h=.25*R,f=(m+I)/R,C=(a-p)/R}else{const R=Math.sqrt(1+g-c-u)*2;l=(a+p)/R,h=(m+I)/R,f=.25*R,C=(d-A)/R}const y=n??new Me;return y.set(l,h,f,C),y}function ht(i,e="ZXY",t){const n=t!==void 0?t.set(0,0,0,1):new Me(0,0,0,1);for(let r=0;r<3;r++)switch(e.charAt(r)){case"X":n.mul(Math.sin(i.x),0,0,Math.cos(i.x));break;case"Y":n.mul(0,Math.sin(i.y),0,Math.cos(i.y));break;case"Z":n.mul(0,0,Math.sin(i.z),Math.cos(i.z));break}return n}function vr(i){const e=[[],[],[]],t=i.x+i.x,n=i.y+i.y,r=i.z+i.z,o=i.x*t,s=i.x*n,c=i.x*r,A=i.y*n,a=i.y*r,d=i.z*r,u=i.w*t,m=i.w*n,p=i.w*r;return e[0][0]=1-(A+d),e[0][1]=s-p,e[0][2]=c+m,e[1][0]=s+p,e[1][1]=1-(o+d),e[1][2]=a-u,e[2][0]=c-m,e[2][1]=a+u,e[2][2]=1-(o+A),e}const gt=i=>Math.max(-1,Math.min(1,i));function Qn(i,e="ZXY",t){const n=vr(i),r=t??new Ae;let o=0,s=0,c=0;switch(e){case"XYZ":s=Math.asin(gt(n[0][2])),Math.abs(n[0][2])<.9999999?(o=Math.atan2(-n[1][2],n[2][2]),c=Math.atan2(-n[0][1],n[0][0])):(o=Math.atan2(n[2][1],n[1][1]),c=0);break;case"YXZ":o=Math.asin(-gt(n[1][2])),Math.abs(n[1][2])<.9999999?(s=Math.atan2(n[0][2],n[2][2]),c=Math.atan2(n[1][0],n[1][1])):(s=Math.atan2(-n[2][0],n[0][0]),c=0);break;case"ZXY":o=Math.asin(gt(n[2][1])),Math.abs(n[2][1])<.9999999?(s=Math.atan2(-n[2][0],n[2][2]),c=Math.atan2(-n[0][1],n[1][1])):(s=0,c=Math.atan2(n[1][0],n[0][0]));break;case"ZYX":s=Math.asin(-gt(n[2][0])),Math.abs(n[2][0])<.9999999?(o=Math.atan2(n[2][1],n[2][2]),c=Math.atan2(n[1][0],n[0][0])):(o=0,c=Math.atan2(-n[0][1],n[1][1]));break;case"YZX":c=Math.asin(gt(n[1][0])),Math.abs(n[1][0])<.9999999?(o=Math.atan2(-n[1][2],n[1][1]),s=Math.atan2(-n[2][0],n[0][0])):(o=0,s=Math.atan2(n[0][2],n[2][2]));break;case"XZY":c=Math.asin(-gt(n[0][1])),Math.abs(n[0][1])<.9999999?(o=Math.atan2(n[2][1],n[1][1]),s=Math.atan2(n[0][2],n[0][0])):(o=Math.atan2(-n[1][2],n[2][2]),s=0);break}return r.set(o,s,c),r}class ze{loc;quat;scale;constructor(){this.loc=new Ae,this.quat=new Me,this.scale=new Ae(1,1,1)}set(e){return e instanceof ze?(this.loc.set(e.loc),this.quat.set(e.quat),this.scale.set(e.scale)):(e.getPosition(this.loc),e.getQuat(this.quat),e.getScale(this.scale)),this}write(e){e instanceof Oe?(e.object3D.position.set(this.loc.x,this.loc.y,this.loc.z),e.object3D.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.object3D.scale.set(this.scale.x,this.scale.y,this.scale.z)):(e.position.set(this.loc.x,this.loc.y,this.loc.z),e.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.scale.set(this.scale.x,this.scale.y,this.scale.z))}blend(e,t){return this.loc.lerp(this.loc,e.loc,t),this.quat.slerp(this.quat,e.quat,t),this.scale.lerp(this.scale,e.scale,t),this}clone(){const e=new ze;return e.set(this),e}}class Rt{transform;constructor(){this.transform=new ze}init(e,t){this.transform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){this.transform.loc.set(e)}setPositionNow(e){this.transform.loc.set(e)}setQuat(e){this.transform.quat.set(e)}setQuatNow(e){this.transform.quat.set(e)}setScale(e){this.transform.scale.set(e)}setScaleNow(e){this.transform.scale.set(e)}setLinearVelocity(e){}getLinearVelocity(e){return e||new Ae}setAngularVelocity(e){}getAngularVelocity(e){return e||new Ae}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}}class Wn{transform;constructor(){this.transform=new ze}init(e,t){this.transform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){}setPositionNow(e){}setQuat(e){}setQuatNow(e){}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||new Ae}setAngularVelocity(e){}getAngularVelocity(e){return e||new Ae}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}}class fn{startTransform;transform;endTransform;currentTime;duration;constructor(){this.startTransform=new ze,this.transform=new ze,this.endTransform=new ze,this.currentTime=0,this.duration=1}init(e,t){this.startTransform.set(e),this.transform.set(e),this.endTransform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){this.startTransform.set(this.transform),this.endTransform.loc.set(e),this.currentTime=0}setPositionNow(e){this.setPosition(e),this.currentTime=1}setQuat(e){this.startTransform.set(this.transform),this.endTransform.quat.set(e),this.currentTime=0}setQuatNow(e){this.setQuat(e),this.currentTime=1}setScale(e){this.startTransform.set(this.transform),this.endTransform.scale.set(e),this.currentTime=0}setScaleNow(e){this.setScale(e),this.currentTime=1}setLinearVelocity(e){}getLinearVelocity(e){e||(e=new Ae);const t=this.endTransform.loc.x-this.startTransform.loc.x,n=this.endTransform.loc.y-this.startTransform.loc.y,r=this.endTransform.loc.z-this.startTransform.loc.z;e.set(t,n,r);const o=this.currentTime<this.duration?this.currentTime:this.duration;return e.scale((-6*o*o+6*o)/this.duration),e}setAngularVelocity(e){}getAngularVelocity(e){e||(e=new Ae),Qn(this.startTransform.quat,"ZXY",_t),Qn(this.endTransform.quat,"ZXY",Dt),e.set(Dt.x-_t.x,Dt.y-_t.y,Dt.z-_t.z);const t=this.currentTime<this.duration?this.currentTime:this.duration;return e.scale((-6*t*t+6*t)/this.duration),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}smoothstep(e){return e*e*(3-2*e)}update(e){this.currentTime+=e,this.currentTime>this.duration&&(this.currentTime=this.duration);const t=this.currentTime/this.duration,n=this.smoothstep(t);this.transform.set(this.startTransform),this.transform.blend(this.endTransform,n)}}const ot=new Ae,yt=new Ae,ft=new Me,Lt=new ze,_t=new Ae,Dt=new Ae,Qr={up:new Ae(0,1,0)};class Yn extends Rt{up;target;constructor(e){super();const t={...Qr,...e};this.target=t.target,this.up=t.up}setTarget(e){this.target=e}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=Oe.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){ot.set(this.transform.loc),this.target.getPosition(yt),At(ot,yt,this.up,ft),this.transform.quat.set(ft)}}const kr={up:new Ae(0,1,0)};class Jn extends fn{up;target;constructor(e){super();const t={...kr,...e};this.target=t.target,this.up=t.up}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=Oe.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){super.update(e),ot.set(this.transform.loc),this.target.getPosition(yt),At(ot,yt,this.up,ft),this.transform.quat.set(ft)}}const Xn={lookFrom:{x:0,y:5,z:-10},smoothness:.9};class Zn extends Wn{target;lookFrom;up;smoothness;constructor(e){super();const t={...Xn,...e};this.target=t.target,this.lookFrom=new Ae(t.lookFrom),this.target.upVector?this.up=this.target.upVector:this.up=Oe.defaultUpVector,this.smoothness=t.smoothness}init(e,t){super.init(e,t)}update(e){super.update(e),ot.set(this.transform.loc),this.target.getPosition(yt),At(ot,yt,this.up,ft),ft.mul(0,1,0,0),Lt.quat.set(ft),ot.set(this.lookFrom),ot.apply(this.target.getQuat()),ot.add(this.target.getPosition()),Lt.loc.set(ot),this.transform.loc.lerp(this.transform.loc,Lt.loc,1-this.smoothness),this.transform.quat.slerp(this.transform.quat,Lt.quat,1-this.smoothness)}}const $n={rigidBody:"dynamic",collider:"solid",meshCollider:"convex_hull",mass:1,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1};function ei(i){return typeof i=="string"}function pn(i){return i.isMesh===!0}function Sr(i){return i.type==="RoundedBoxGeometry"}function xr(i){return i.type==="BoxGeometry"}function Lr(i){return i.type==="SphereGeometry"}function _r(i){return i.type==="IcosahedronGeometry"}function Dr(i){return i.type==="CylinderGeometry"}function Nr(i){return i.type==="CapsuleGeometry"}function Fr(i){return i.isBone===!0}function Or(i){return i.isPerspectiveCamera===!0}let je;const it=new Map;class vt{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!vt.RAPIER){const e=await import("@dimforge/rapier3d-compat");await e.init(),vt.RAPIER=e,je=e,this.isInitialized=!0}}createWorld(e){let t=.016666666666666666;this.isRapierWorldOptions(e)&&(t=e.timestep);const n=new je.World(e.gravity);return new gn(n,t)}isRapierWorldOptions(e){return"timestep"in e}}class gn{world;timestep;collisionEventQueue;constructor(e,t){this.world=e,this.timestep=t,this.collisionEventQueue=new je.EventQueue(!0),this.world.integrationParameters.dt=this.timestep}add(e){e.addOneselfToPhysics(this)}remove(e){e.removeOneselfFromPhysics(this)}update(e){const t=Math.ceil(e/this.timestep);for(let n=0;n<t;n++)this.world.step(this.collisionEventQueue)}getCollisions(){const e=[];return this.collisionEventQueue.drainCollisionEvents((t,n,r)=>{const o=it.get(t),s=it.get(n);o&&s&&e.push({objectA:o,partOfA:t,objectB:s,partOfB:n,started:r})}),e}}class kn{transform;objectA3;bodyDesc;body;colliderDescs;colliders;completeOptions;constructor(e={}){this.completeOptions={...$n,...e},this.transform=new ze,this.colliderDescs=[],this.colliders=[]}makeBodyDesc(){let e;switch(this.completeOptions.rigidBody){case"dynamic":e=je.RigidBodyDesc.dynamic();break;case"kinematic":e=je.RigidBodyDesc.kinematicPositionBased();break;case"fixed":e=je.RigidBodyDesc.fixed();break}return e.setTranslation(this.transform.loc.x,this.transform.loc.y,this.transform.loc.z),e.setRotation({x:this.transform.quat.x,y:this.transform.quat.y,z:this.transform.quat.z,w:this.transform.quat.w}),e}configColliderDescs(){if(!this.objectA3)return;const e=this.completeOptions,t=[];this.objectA3.object3D.traverse(r=>{if(pn(r)){const o=Gr(r.geometry),s=e.membership<<16|e.filter;if(o)o.colliderDesc.setCollisionGroups(s),e.collisionDetection&&o.colliderDesc.setActiveEvents(je.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(o.colliderDesc),o.colliderDesc.setRestitution(e.restitution).setFriction(e.friction),t.push(o.volume);else{let c,A;switch(e.meshCollider){case"tri_mesh":c=Mr(r),A=Sn(r.geometry);break;case"convex_hull":c=Pr(r),A=Sn(r.geometry);break}c&&(c.setCollisionGroups(s),e.collisionDetection&&c.setActiveEvents(je.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(c),t.push(A))}}});let n=t.reduce((r,o)=>r+o,0);for(let r=0;r<this.colliderDescs.length;r++)this.colliderDescs[r].setRestitution(e.restitution),this.colliderDescs[r].setFriction(e.friction),this.colliderDescs[r].setMass(e.mass*(t[r]/n))}init(e,t){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)}addOneselfToPhysics(e){this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.colliderDescs.forEach(t=>{const n=e.world.createCollider(t,this.body);this.colliders.push(n),this.objectA3&&it.set(n.handle,this.objectA3)}),this.body.setTranslation(this.transform.loc,!0),this.body.setRotation(this.transform.quat,!0))}removeOneselfFromPhysics(e){this.body&&e.world.removeRigidBody(this.body),this.colliders.forEach(t=>{e.world.removeCollider(t,!1),it.delete(t.handle)})}isGrounded(){return this.transform.loc.y<=0}setPosition(e){}setPositionNow(e){this.body?this.body.setTranslation(e,!0):this.bodyDesc?.setTranslation(e.x,e.y,e.z),this.transform.loc.set(e)}setQuat(e){}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}getLinearVelocity(e){return e||(e=new Ae),this.body?e.set(this.body.linvel()):this.bodyDesc&&e.set(this.bodyDesc.linvel),e}setAngularVelocity(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}getAngularVelocity(e){return e||(e=new Ae),this.body?e.set(this.body.angvel()):this.bodyDesc&&e.set(this.bodyDesc.angvel),e}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}update(e){if(this.body){const t=this.body.translation();this.transform.loc.set(t.x,t.y,t.z);const n=this.body.rotation();this.transform.quat.set(n.x,n.y,n.z,n.w)}}}function Mr(i){let e=null;if(pn(i)){const t=i;t.updateWorldMatrix(!0,!0);const n=t.geometry.clone();n.applyMatrix4(t.matrixWorld);const r=n.attributes.position.array;let o=n.index?n.index.array:null;if(o)o instanceof Uint32Array||(o=new Uint32Array(o));else{const s=n.attributes.position.count;o=new Uint32Array(s);for(let c=0;c<s;c++)o[c]=c}r instanceof Float32Array&&(e=je.ColliderDesc.trimesh(r,o))}return e}function Pr(i){let e=null;if(pn(i)){const t=i;t.updateWorldMatrix(!0,!0);const n=t.geometry.clone();n.applyMatrix4(t.matrixWorld);const r=n.attributes.position.array;r instanceof Float32Array&&(e=je.ColliderDesc.convexHull(r))}return e}function Sn(i){const e=i.attributes.position;if(!e)throw new Error("position attribute not found");const t=i.index,n=e.array;let r=0;const o=new oe.Vector3,s=new oe.Vector3,c=new oe.Vector3;if(t){const A=t.array;for(let a=0;a<A.length;a+=3){const d=A[a]*3,u=A[a+1]*3,m=A[a+2]*3;o.set(n[d],n[d+1],n[d+2]),s.set(n[u],n[u+1],n[u+2]),c.set(n[m],n[m+1],n[m+2]),r+=o.dot(s.clone().cross(c))}}else for(let A=0;A<n.length;A+=9)o.set(n[A],n[A+1],n[A+2]),s.set(n[A+3],n[A+4],n[A+5]),c.set(n[A+6],n[A+7],n[A+8]),r+=o.dot(s.clone().cross(c));return Math.abs(r)/6}function Gr(i){if(Sr(i)){const e=i.parameters,t=typeof e?.width=="number"?e.width/2:.5,n=typeof e?.height=="number"?e.height/2:.5,r=typeof e?.depth=="number"?e.depth/2:.5,o=.1;return{colliderDesc:je.ColliderDesc.roundCuboid(t-o,n-o,r-o,o),volume:2*t*2*n*2*r}}else if(xr(i)){const e=i.parameters,t=typeof e?.width=="number"?e.width/2:.5,n=typeof e?.height=="number"?e.height/2:.5,r=typeof e?.depth=="number"?e.depth/2:.5;return{colliderDesc:je.ColliderDesc.cuboid(t,n,r),volume:2*t*2*n*2*r}}else if(Lr(i)){const e=i.parameters,t=typeof e?.radius=="number"?e.radius:1;return{colliderDesc:je.ColliderDesc.ball(t),volume:4/3*Math.PI*t*t*t}}else if(_r(i)){const e=i.parameters,t=typeof e?.radius=="number"?e.radius:1;return{colliderDesc:je.ColliderDesc.ball(t),volume:4/3*Math.PI*t*t*t}}else if(Dr(i)){const e=i.parameters,t=typeof e?.radiusBottom=="number"?e.radiusBottom:.5,n=typeof e?.height=="number"?e.height:.5;return{colliderDesc:je.ColliderDesc.cylinder(n/2,t),volume:Math.PI*t*t*n}}else if(Nr(i)){const e=i.parameters,t=typeof e?.radius=="number"?e.radius:.5,n=typeof e?.height=="number"?e.height:.5;return{colliderDesc:je.ColliderDesc.capsule(n/2,t),volume:4/3*Math.PI*t*t*t+Math.PI*t*t*n}}return null}const on=new vt;async function Ur(){await on.init()}const _={v0:new Ae,v1:new Ae,v2:new Ae,v3:new Ae,v4:new Ae,q0:new Me,q1:new Me,q2:new Me,q3:new Me,q4:new Me,t0:new ze,t1:new ze,t2:new ze,t3:new ze,t4:new ze};function jr(i){return new Promise(e=>{setTimeout(()=>{e()},i)})}async function ti(i){const t=await(await fetch(i)).arrayBuffer(),n=await new Promise((r,o)=>{Kn.unzip(new Uint8Array(t),(s,c)=>{s?o(s):r(c)})});return{zipUrl:i,unzipped:n}}function Nt(i,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),i.unzipped[e])return Kn.strFromU8(i.unzipped[e]);throw new Error(`readStringFromUnzippedA3(): no file at ${e}`)}function sn(i,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),i.unzipped[e]){const t=qr(e);return new Blob([new Uint8Array(i.unzipped[e])],{type:t})}else throw new Error(`readBlobFromUnzippedA3(): no file at ${e}`)}const Hr={"image/png":/\.png$/i,"image/jpeg":/\.(jpg|jpeg)$/i,"image/gif":/\.gif$/i,"model/vrml":/\.wrl$/i,"application/xml":/\.xml$/i,"application/octet-stream":/\.bvh/i,"audio/x-wav":/\.wav/i,"audio/mpeg":/\.mp3/i,"audio/ogg":/\.ogg/i,"text/plain":/\.(txt|text)$/i,"model/gltf+json":/\.gltf$/i,"model/gltf-binary":/\.glb$/i};function qr(i){for(const[e,t]of Object.entries(Hr))if(t.test(i))return e;return"application/octet-stream"}function Ot(i,e){if(!e)return i;const t={...i};for(const n in e)typeof i[n]=="object"&&typeof e[n]=="object"?t[n]=Ot(i[n],e[n]):t[n]=e[n];return t}const ni={offset:.01,auto:!0,height:1.5,radius:.3};class ii{transform;objectA3;completeOptions;controller;colliderDesc;collider;capsuleCenter;nextLocation;tmpV1;tmpV2;tmpQ1;constructor(e={}){this.completeOptions={...ni,...e},this.transform=new ze,this.capsuleCenter=new Ae,this.nextLocation=new Ae,this.tmpV1=new Ae,this.tmpV2=new Ae,this.tmpQ1=new Me}init(e,t){if(this.transform.set(e),this.completeOptions.auto){const n=new oe.Vector3,r=new oe.Quaternion,o=new oe.Object3D;o.add(t.object3D),t.getPosition(this.tmpV1),this.tmpV1.write(n),o.position.set(n.x,n.y,n.z),t.getQuat(this.tmpQ1),this.tmpQ1.write(r),o.quaternion.set(r.x,r.y,r.z,r.w),t.getScale(this.tmpV2),this.tmpV2.write(n),o.scale.set(n.x,n.y,n.z);const s=new oe.Box3().setFromObject(o);o.remove(t.object3D),s.getSize(n),this.completeOptions.radius=Math.max(n.x,n.z)/2,this.completeOptions.height=n.y-this.completeOptions.radius*2,s.getCenter(n),this.capsuleCenter.set(n)}this.colliderDesc=je.ColliderDesc.capsule(this.completeOptions.height,this.completeOptions.radius),this.colliderDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.colliderDesc.setRotation({x:e.quat.x,y:e.quat.y,z:e.quat.z,w:e.quat.w})}addOneselfToPhysics(e){this.controller=e.world.createCharacterController(this.completeOptions.offset),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc)),this.collider&&this.objectA3&&it.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.collider&&(e.world.removeCollider(this.collider,!1),it.delete(this.collider.handle))}setPosition(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.nextLocation.set(this.tmpV1)}setPositionNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),e=this.tmpV1,this.collider&&this.collider.setTranslation(e),this.transform.loc.set(e),this.nextLocation.set(e)}setQuat(e){this.collider&&this.collider.setRotation(e),this.transform.quat.set(e)}setQuatNow(e){this.collider&&this.collider.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||(e=new Ae),e.set(0,0,0),e}setAngularVelocity(e){}getAngularVelocity(e){return e||(e=new Ae),e.set(0,0,0),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}isGrounded(){return this.controller?this.controller.computedGrounded():!1}update(e){if(!this.controller||!this.collider)return;this.transform.quat.set(this.collider.rotation()),this.tmpV1.set(this.collider.translation()),this.tmpV2.set(this.nextLocation),this.tmpV2.sub(this.tmpV1),this.controller.computeColliderMovement(this.collider,this.tmpV2);const t=this.controller.computedMovement();this.tmpV1.add(t),this.collider.setTranslation(this.tmpV1),this.tmpV1.sub(this.capsuleCenter),this.transform.loc.set(this.tmpV1),this.nextLocation.set(this.tmpV1)}}const ri={auto:!0,height:1.5,radius:.3};class oi{transform;objectA3;completeOptions;colliderDesc;collider;bodyDesc;body;capsuleCenter;nextLocation;tmpV1;tmpV2;tmpQ1;physicsWorld;constructor(e={}){this.completeOptions={...ri,...e},this.transform=new ze,this.capsuleCenter=new Ae,this.nextLocation=new Ae,this.tmpV1=new Ae,this.tmpV2=new Ae,this.tmpQ1=new Me}init(e,t){if(this.transform.set(e),this.completeOptions.auto){const n=new oe.Vector3,r=new oe.Quaternion,o=new oe.Object3D;o.add(t.object3D),t.getPosition(this.tmpV1),this.tmpV1.write(n),o.position.set(n.x,n.y,n.z),t.getQuat(this.tmpQ1),this.tmpQ1.write(r),o.quaternion.set(r.x,r.y,r.z,r.w),t.getScale(this.tmpV2),this.tmpV2.write(n),o.scale.set(n.x,n.y,n.z);const s=new oe.Box3().setFromObject(o);s.getSize(n),this.completeOptions.radius=Math.max(n.x,n.z)/2,this.completeOptions.height=n.y-this.completeOptions.radius*2,s.getCenter(n),this.capsuleCenter.set(n)}this.bodyDesc=je.RigidBodyDesc.dynamic(),this.bodyDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.bodyDesc.setRotation(e.quat),this.colliderDesc=je.ColliderDesc.capsule(this.completeOptions.height,this.completeOptions.radius)}addOneselfToPhysics(e){this.physicsWorld=e,this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.body.setEnabledRotations(!1,!1,!1,!0),this.body.setTranslation(this.transform.loc,!0),this.body.setRotation(this.transform.quat,!0)),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc,this.body)),this.collider&&this.objectA3&&it.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.body&&e.world.removeRigidBody(this.body),this.collider&&(e.world.removeCollider(this.collider,!1),it.delete(this.collider.handle)),this.physicsWorld=void 0}setPosition(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.nextLocation.set(this.tmpV1)}setPositionNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),e=this.tmpV1,this.body?this.body.setTranslation(e,!0):this.bodyDesc?.setTranslation(e.x,e.y,e.z),this.transform.loc.set(e),this.nextLocation.set(e)}setQuat(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}getLinearVelocity(e){return e||(e=new Ae),this.body?e.set(this.body.linvel()):this.bodyDesc&&e.set(this.bodyDesc.linvel),e}setAngularVelocity(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}getAngularVelocity(e){return e||(e=new Ae),this.body?e.set(this.body.angvel()):this.bodyDesc&&e.set(this.bodyDesc.angvel),e}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}isGrounded(){if(this.body&&this.physicsWorld){const e=this.body.translation(),t=new je.Ray(e,{x:0,y:-1,z:0}),n=1.1*(this.completeOptions.height+this.completeOptions.radius);return this.physicsWorld.world.castRay(t,n,!0,void 0,void 0,this.collider)!==null}else return this.transform.loc.y<=0}update(e){if(!this.body)return;const t=new Ae(this.body.translation());t.sub(this.capsuleCenter),this.transform.loc.set(t),this.transform.quat.set(this.body.rotation())}}const zr=new oe.SphereGeometry,Vr=new oe.MeshStandardMaterial({color:16711680});let Kr=new oe.Mesh(zr,Vr);class Oe{static defaultRotationOrder="ZXY";static defaultUpVector=new Ae(0,1,0);rotationOrder;upVector;object3D;scene;balloon;transformer;parent;children=[];clickListener;constructor(e){this.transformer=this.initTransformer(e),this.object3D=new oe.Object3D;const t=this.initObject(e);t&&this.object3D.add(t),this.object3D.traverse(n=>{n.userData.a3js={objectA3:this}})}initObject(e){return Kr.clone()}initTransformer(e){return new Rt}setTransformer(e){_.t0.set(this.transformer.transform),e.init(_.t0,this),this.transformer=e}getTransformer(){return this.transformer}setTransformMode(e,t){e==="Default"?this.setTransformer(new Rt):e==="Smooth"?this.setTransformer(new fn):e==="Follow"?this.setTransformer(new Zn(t)):e==="Billboard"?this.setTransformer(new Yn(t)):e==="SmoothBillboard"?this.setTransformer(new Jn(t)):e==="SimplePhysics"?this.setTransformer(new kn(t)):e==="KinematicCharacter"?this.setTransformer(new ii(t)):e==="DynamicCharacter"&&this.setTransformer(new oi(t))}initSimplePhysics(e){const t={...$n,...e};this.setTransformer(new kn(t))}update(e){this.transformer.update(e),this.transformer.transform.write(this),this.children.forEach(t=>{t.update(e)})}add(e){if(e.scene){console.warn("ObjectA3.add(obj) is ignored.");return}if(e.parent){console.warn("ObjectA3.add(obj) is ignored.");return}this.children.push(e),e.parent=this,this.object3D.add(e.object3D)}remove(e){if(e.parent!==this){console.warn("ObjectA3.remove(obj) is ignored.");return}const t=this.children.indexOf(e);this.children.splice(t,1),e.parent=void 0,this.object3D.remove(e.object3D)}setSpeechBubble(e){this.balloon?this.balloon.message=e:this.balloon=new Wr(e)}setClickListener(e){this.clickListener=e}handleCollision(e,t,n,r){}async clicked(){this.clickListener&&await this.clickListener(this)}getPosition(e){return e?(e.set(this.transformer.transform.loc),e):this.transformer.transform.loc.clone()}setPosition(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setPosition(_.v0)}setPositionNow(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setPositionNow(_.v0)}getQuat(e){return e?(e.set(this.transformer.transform.quat),e):this.transformer.transform.quat.clone()}setQuat(e,t,n,r){typeof e=="number"?_.q0.set(e,t,n,r):_.q0.set(e),this.transformer.setQuat(_.q0)}setQuatNow(e,t,n,r){typeof e=="number"?_.q0.set(e,t,n,r):_.q0.set(e),this.transformer.setQuatNow(_.q0)}getScale(e){return e?(e.set(this.transformer.transform.scale),e):this.transformer.transform.scale.clone()}setScale(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setScale(_.v0)}setScaleNow(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setScaleNow(_.v0)}setRotation(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),_.v0.scale(Math.PI/360);const r=this.rotationOrder?this.rotationOrder:Oe.defaultRotationOrder;ht(_.v0,r,_.q1),this.setQuat(_.q1)}setRotationNow(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),_.v0.scale(Math.PI/360);const r=this.rotationOrder?this.rotationOrder:Oe.defaultRotationOrder;ht(_.v0,r,_.q0),this.setQuatNow(_.q0)}lookAt(e,t,n){typeof e=="number"?_.v1.set(e,t,n):e instanceof Oe?_.v1.set(e.transformer.transform.loc):_.v1.set(e);const r=this.upVector?this.upVector:Oe.defaultUpVector;At(this.transformer.transform.loc,_.v1,r,_.q1),this.setQuat(_.q1)}lookAtNow(e,t,n){typeof e=="number"?_.v1.set(e,t,n):e instanceof Oe?_.v1.set(e.transformer.transform.loc):_.v1.set(e);const r=this.upVector?this.upVector:Oe.defaultUpVector;At(this.transformer.transform.loc,_.v1,r,_.q1),this.setQuatNow(_.q1)}getUnitVecX(e){return e?(e.set(1,0,0),e.apply(this.object3D.quaternion)):new Ae(1,0,0).apply(this.object3D.quaternion)}getUnitVecY(e){return e?(e.set(0,1,0),e.apply(this.object3D.quaternion)):new Ae(0,1,0).apply(this.object3D.quaternion)}getUnitVecZ(e){return e?(e.set(0,0,1),e.apply(this.object3D.quaternion)):new Ae(0,0,1).apply(this.object3D.quaternion)}translate(e,t,n){_.v1.set(this.transformer.transform.loc),typeof e=="number"?_.v1.add(e,t,n):_.v1.add(e),this.setPosition(_.v1)}translateNow(e,t,n){_.v1.set(this.transformer.transform.loc),typeof e=="number"?_.v1.add(e,t,n):_.v1.add(e),this.setPositionNow(_.v1)}mulQuat(e,t,n,r){_.q1.set(this.transformer.transform.quat),typeof e=="number"?_.q1.mul(e,t,n,r):_.q1.mul(e),this.setQuat(_.q1)}mulQuatNow(e,t,n,r){_.q1.set(this.transformer.transform.quat),typeof e=="number"?_.q1.mul(e,t,n,r):_.q1.mul(e),this.setQuatNow(_.q1)}mulRotation(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),_.v0.scale(Math.PI/360);const r=this.rotationOrder?this.rotationOrder:Oe.defaultRotationOrder;ht(_.v0,r,_.q1),this.getQuat(_.q0),_.q0.mul(_.q1),this.setQuat(_.q0)}mulRotationNow(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),_.v0.scale(Math.PI/360);const r=this.rotationOrder?this.rotationOrder:Oe.defaultRotationOrder;ht(_.v0,r,_.q1),this.getQuat(_.q0),_.q0.mul(_.q1),this.setQuatNow(_.q0)}scaleBy(e,t,n){this.getScale(_.v0),typeof e=="number"?_.v0.set(_.v0.x*e,_.v0.y*t,_.v0.z*n):_.v0.set(_.v0.x*e.x,_.v0.y*e.y,_.v0.z*e.z),this.setScale(_.v0)}mulScaleNow(e,t,n){this.getScale(_.v0),typeof e=="number"?_.v0.set(_.v0.x*e,_.v0.y*t,_.v0.z*n):_.v0.set(_.v0.x*e.x,_.v0.y*e.y,_.v0.z*e.z),this.setScaleNow(_.v0)}moveForward(e){this.getUnitVecZ(_.v0),_.v0.scale(e),this.translate(_.v0)}moveForwardNow(e){this.getUnitVecZ(_.v0),_.v0.scale(e),this.translateNow(_.v0)}moveBackward(e){this.getUnitVecZ(_.v0),_.v0.scale(-e),this.translate(_.v0)}moveBackwardNow(e){this.getUnitVecZ(_.v0),_.v0.scale(-e),this.translateNow(_.v0)}moveRight(e){this.getUnitVecX(_.v0),_.v0.scale(-e),this.translate(_.v0)}moveRightNow(e){this.getUnitVecX(_.v0),_.v0.scale(-e),this.translateNow(_.v0)}moveLeft(e){this.getUnitVecX(_.v0),_.v0.scale(e),this.translate(_.v0)}moveLeftNow(e){this.getUnitVecX(_.v0),_.v0.scale(e),this.translateNow(_.v0)}moveUp(e){this.getUnitVecY(_.v0),_.v0.scale(e),this.translate(_.v0)}moveUpNow(e){this.getUnitVecY(_.v0),_.v0.scale(e),this.translateNow(_.v0)}moveDown(e){this.getUnitVecY(_.v0),_.v0.scale(-e),this.translate(_.v0)}moveDownNow(e){this.getUnitVecY(_.v0),_.v0.scale(-e),this.translateNow(_.v0)}turnUp(e){this.mulRotation(-e,0,0)}turnUpNow(e){this.mulRotationNow(-e,0,0)}turnDown(e){this.mulRotation(e,0,0)}turnDownNow(e){this.mulRotationNow(e,0,0)}turnRight(e){this.mulRotation(0,-e,0)}turnRightNow(e){this.mulRotationNow(0,-e,0)}turnLeft(e){this.mulRotation(0,e,0)}turnLeftNow(e){this.mulRotationNow(0,e,0)}rollRight(e){this.mulRotation(0,0,e)}rollRightNow(e){this.mulRotationNow(0,0,e)}rollLeft(e){this.mulRotation(0,0,-e)}rollLeftNow(e){this.mulRotationNow(0,0,-e)}setLinearVelocity(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setLinearVelocity(_.v0)}getLinearVelocity(e){return this.transformer.getLinearVelocity(e)}setAngularVelocity(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setAngularVelocity(_.v0)}getAngularVelocity(e){return this.transformer.getAngularVelocity(e)}resetForce(){this.transformer.resetForce()}addForce(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.addForce(_.v0)}addForceAtPoint(e,t,n,r,o,s){if(typeof e=="number")if(typeof t=="number")_.v0.set(e,t,n),_.v1.set(r,o,s);else{console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else if(typeof t=="number"){console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else _.v0.set(e),_.v1.set(t);this.transformer.addForceAtPoint(_.v0,_.v1)}resetTorque(){this.transformer.resetTorque()}addTorque(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.addTorque(_.v0)}applyImpulse(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.applyImpulse(_.v0)}applyImpulseAtPoint(e,t,n,r,o,s){if(typeof e=="number")if(typeof t=="number")_.v0.set(e,t,n),_.v1.set(r,o,s);else{console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else if(typeof t=="number"){console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else _.v0.set(e),_.v1.set(t);this.transformer.applyImpulseAtPoint(_.v0,_.v1)}applyTorqueImpulse(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.applyTorqueImpulse(_.v0)}addOneselfToPhysics(e){this.transformer.addOneselfToPhysics(e)}removeOneselfFromPhysics(e){this.transformer.removeOneselfFromPhysics(e)}isGrounded(){return this.transformer.isGrounded()}}class Wr{message;dir;offsetTop;offsetRight;offsetLeft;offsetBottom;constructor(e){this.message=e,this.dir="RIGHT",this.offsetTop={x:0,y:2},this.offsetRight={x:1,y:1},this.offsetLeft={x:-1,y:1},this.offsetBottom={x:0,y:0}}}class mn{shape;motion;constructor(e,t){this.shape=e,this.motion=t}enable(e,t){this.motion.playCount=0,this.motion.time=0,e.add(this.shape.root)}disable(e,t){e.remove(this.shape.root)}}class bt extends Oe{ready;actions;currentAction;stateAction;emoteAction;morphs;overwriteMorphs;constructor(e){super(e),this.actions={},this.morphs={},this.overwriteMorphs=!1,this.ready=this.asyncInit(e)}syncInit(e,t,n={}){this.actions=t,this.stateAction=this.actions[e],this.currentAction=this.stateAction,this.object3D.clear(),this.morphs=n,this.stateAction?.enable(this.object3D,this.scene)}setActions(e){this.actions=e}getAction(e){return this.actions[e]}addAction(e,t){this.actions[e]=t}removeAction(e){const t=this.actions[e];return delete this.actions[e],t}getActionNames(){return Object.keys(this.actions)}setState(e){const t=this.actions[e];t&&(this.currentAction&&this.currentAction.disable(this.object3D,this.scene),t.enable(this.object3D,this.scene),this.currentAction=t,this.stateAction=t)}setEmote(e){const t=this.actions[e];t&&(this.currentAction&&this.currentAction.disable(this.object3D,this.scene),t.enable(this.object3D,this.scene),this.currentAction=t,this.emoteAction=t)}setMorphsOverwrite(e){this.overwriteMorphs=e}setMorph(e,t){if(e in this.morphs){const{array:n,idx:r}=this.morphs[e];n[r]=t}}getMorphNames(){return Object.keys(this.morphs)}pose={};update(e){super.update(e);let t;if(this.emoteAction&&this.emoteAction.motion.playCount<=0?(t=this.emoteAction.motion.update(e),this.emoteAction.motion.playCount>0&&(this.emoteAction.disable(this.object3D,this.scene),this.emoteAction=void 0,this.stateAction&&(this.stateAction.enable(this.object3D,this.scene),this.currentAction=this.stateAction))):this.stateAction&&(t=this.stateAction.motion.update(e)),t&&this.currentAction&&this.currentAction.shape.bones)for(const[n,r]of Object.entries(t)){const o=this.currentAction.shape.bones[n];if(o&&(r.loc&&o.position.set(r.loc.x,r.loc.y,r.loc.z),r.quat&&o.quaternion.set(r.quat.x,r.quat.y,r.quat.z,r.quat.w),r.scale&&o.scale.set(r.scale.x,r.scale.y,r.scale.z)),!this.overwriteMorphs&&r.morphs){for(const s of r.morphs)for(const c of Object.keys(this.morphs))if(c.startsWith(s.name)){const{array:A}=this.morphs[c];for(let a=0;a<A.length;a++)A[a]=s.vals[a];break}}}this.object3D.updateMatrixWorld(!0),this.currentAction&&this.currentAction.shape.skeleton?.update()}}class xn{name;playCount;time;finishListener;constructor(){this.name="dummy",this.playCount=0,this.time=0}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setPause(e){}setTime(e){}setFinishListener(e){this.finishListener=e}update(e){return{}}}var Re=(i,e)=>()=>(e||(e={exports:{}},i(e.exports,e)),e.exports),si=Re(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.VERSION=void 0,i.VERSION="9.0.1"}),Ne=Re((i,e)=>{var t=i&&i.__spreadArray||function(O,X){for(var z=0,re=X.length,fe=O.length;z<re;z++,fe++)O[fe]=X[z];return O};Object.defineProperty(i,"__esModule",{value:!0}),i.toFastProperties=i.timer=i.peek=i.isES2015MapSupported=i.PRINT_WARNING=i.PRINT_ERROR=i.packArray=i.IDENTITY=i.NOOP=i.merge=i.groupBy=i.defaults=i.assignNoOverwrite=i.assign=i.zipObject=i.sortBy=i.indexOf=i.some=i.difference=i.every=i.isObject=i.isRegExp=i.isArray=i.partial=i.uniq=i.compact=i.reduce=i.findAll=i.find=i.cloneObj=i.cloneArr=i.contains=i.has=i.pick=i.reject=i.filter=i.dropRight=i.drop=i.isFunction=i.isUndefined=i.isString=i.forEach=i.last=i.first=i.flatten=i.map=i.mapValues=i.values=i.keys=i.isEmpty=void 0;function n(O){return O&&O.length===0}i.isEmpty=n;function r(O){return O==null?[]:Object.keys(O)}i.keys=r;function o(O){for(var X=[],z=Object.keys(O),re=0;re<z.length;re++)X.push(O[z[re]]);return X}i.values=o;function s(O,X){for(var z=[],re=r(O),fe=0;fe<re.length;fe++){var Qe=re[fe];z.push(X.call(null,O[Qe],Qe))}return z}i.mapValues=s;function c(O,X){for(var z=[],re=0;re<O.length;re++)z.push(X.call(null,O[re],re));return z}i.map=c;function A(O){for(var X=[],z=0;z<O.length;z++){var re=O[z];Array.isArray(re)?X=X.concat(A(re)):X.push(re)}return X}i.flatten=A;function a(O){return n(O)?void 0:O[0]}i.first=a;function d(O){var X=O&&O.length;return X?O[X-1]:void 0}i.last=d;function u(O,X){if(Array.isArray(O))for(var z=0;z<O.length;z++)X.call(null,O[z],z);else if($(O))for(var re=r(O),z=0;z<re.length;z++){var fe=re[z],Qe=O[fe];X.call(null,Qe,fe)}else throw Error("non exhaustive match")}i.forEach=u;function m(O){return typeof O=="string"}i.isString=m;function p(O){return O===void 0}i.isUndefined=p;function I(O){return O instanceof Function}i.isFunction=I;function g(O,X){return X===void 0&&(X=1),O.slice(X,O.length)}i.drop=g;function l(O,X){return X===void 0&&(X=1),O.slice(0,O.length-X)}i.dropRight=l;function h(O,X){var z=[];if(Array.isArray(O))for(var re=0;re<O.length;re++){var fe=O[re];X.call(null,fe)&&z.push(fe)}return z}i.filter=h;function f(O,X){return h(O,function(z){return!X(z)})}i.reject=f;function C(O,X){for(var z=Object.keys(O),re={},fe=0;fe<z.length;fe++){var Qe=z[fe],ye=O[Qe];X(ye)&&(re[Qe]=ye)}return re}i.pick=C;function b(O,X){return $(O)?O.hasOwnProperty(X):!1}i.has=b;function y(O,X){return q(O,function(z){return z===X})!==void 0}i.contains=y;function R(O){for(var X=[],z=0;z<O.length;z++)X.push(O[z]);return X}i.cloneArr=R;function x(O){var X={};for(var z in O)Object.prototype.hasOwnProperty.call(O,z)&&(X[z]=O[z]);return X}i.cloneObj=x;function q(O,X){for(var z=0;z<O.length;z++){var re=O[z];if(X.call(null,re))return re}}i.find=q;function v(O,X){for(var z=[],re=0;re<O.length;re++){var fe=O[re];X.call(null,fe)&&z.push(fe)}return z}i.findAll=v;function G(O,X,z){for(var re=Array.isArray(O),fe=re?O:o(O),Qe=re?[]:r(O),ye=z,le=0;le<fe.length;le++)ye=X.call(null,ye,fe[le],re?le:Qe[le]);return ye}i.reduce=G;function D(O){return f(O,function(X){return X==null})}i.compact=D;function Q(O,X){X===void 0&&(X=function(re){return re});var z=[];return G(O,function(re,fe){var Qe=X(fe);return y(z,Qe)?re:(z.push(Qe),re.concat(fe))},[])}i.uniq=Q;function F(O){for(var X=[],z=1;z<arguments.length;z++)X[z-1]=arguments[z];var re=[null],fe=re.concat(X);return Function.bind.apply(O,fe)}i.partial=F;function L(O){return Array.isArray(O)}i.isArray=L;function J(O){return O instanceof RegExp}i.isRegExp=J;function $(O){return O instanceof Object}i.isObject=$;function j(O,X){for(var z=0;z<O.length;z++)if(!X(O[z],z))return!1;return!0}i.every=j;function ee(O,X){return f(O,function(z){return y(X,z)})}i.difference=ee;function ne(O,X){for(var z=0;z<O.length;z++)if(X(O[z]))return!0;return!1}i.some=ne;function ue(O,X){for(var z=0;z<O.length;z++)if(O[z]===X)return z;return-1}i.indexOf=ue;function ie(O,X){var z=R(O);return z.sort(function(re,fe){return X(re)-X(fe)}),z}i.sortBy=ie;function Z(O,X){if(O.length!==X.length)throw Error("can't zipObject with different number of keys and values!");for(var z={},re=0;re<O.length;re++)z[O[re]]=X[re];return z}i.zipObject=Z;function se(O){for(var X=[],z=1;z<arguments.length;z++)X[z-1]=arguments[z];for(var re=0;re<X.length;re++)for(var fe=X[re],Qe=r(fe),ye=0;ye<Qe.length;ye++){var le=Qe[ye];O[le]=fe[le]}return O}i.assign=se;function de(O){for(var X=[],z=1;z<arguments.length;z++)X[z-1]=arguments[z];for(var re=0;re<X.length;re++)for(var fe=X[re],Qe=r(fe),ye=0;ye<Qe.length;ye++){var le=Qe[ye];b(O,le)||(O[le]=fe[le])}return O}i.assignNoOverwrite=de;function P(){for(var O=[],X=0;X<arguments.length;X++)O[X]=arguments[X];return de.apply(void 0,t([{}],O))}i.defaults=P;function H(O,X){var z={};return u(O,function(re){var fe=X(re),Qe=z[fe];Qe?Qe.push(re):z[fe]=[re]}),z}i.groupBy=H;function Y(O,X){for(var z=x(O),re=r(X),fe=0;fe<re.length;fe++){var Qe=re[fe],ye=X[Qe];z[Qe]=ye}return z}i.merge=Y;function V(){}i.NOOP=V;function K(O){return O}i.IDENTITY=K;function ce(O){for(var X=[],z=0;z<O.length;z++){var re=O[z];X.push(re!==void 0?re:void 0)}return X}i.packArray=ce;function Be(O){console&&console.error&&console.error("Error: "+O)}i.PRINT_ERROR=Be;function Te(O){console&&console.warn&&console.warn("Warning: "+O)}i.PRINT_WARNING=Te;function De(){return typeof Map=="function"}i.isES2015MapSupported=De;function Ve(O){return O[O.length-1]}i.peek=Ve;function Je(O){var X=new Date().getTime(),z=O(),re=new Date().getTime(),fe=re-X;return{time:fe,value:z}}i.timer=Je;function qe(O){function X(){}X.prototype=O;var z=new X;function re(){return typeof z.bar}return re(),re(),O}i.toFastProperties=qe}),En=Re((i,e)=>{(function(t,n){typeof define=="function"&&define.amd?define([],n):typeof e=="object"&&e.exports?e.exports=n():t.regexpToAst=n()})(typeof self<"u"?self:i,function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(l){this.idx=l.idx,this.input=l.input,this.groupIdx=l.groupIdx},t.prototype.pattern=function(l){this.idx=0,this.input=l,this.groupIdx=0,this.consumeChar("/");var h=this.disjunction();this.consumeChar("/");for(var f={type:"Flags",loc:{begin:this.idx,end:l.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":A(f,"global");break;case"i":A(f,"ignoreCase");break;case"m":A(f,"multiLine");break;case"u":A(f,"unicode");break;case"y":A(f,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:f,value:h,loc:this.loc(0)}},t.prototype.disjunction=function(){var l=[],h=this.idx;for(l.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),l.push(this.alternative());return{type:"Disjunction",value:l,loc:this.loc(h)}},t.prototype.alternative=function(){for(var l=[],h=this.idx;this.isTerm();)l.push(this.term());return{type:"Alternative",value:l,loc:this.loc(h)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var l=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(l)};case"$":return{type:"EndAnchor",loc:this.loc(l)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(l)};case"B":return{type:"NonWordBoundary",loc:this.loc(l)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var h;switch(this.popChar()){case"=":h="Lookahead";break;case"!":h="NegativeLookahead";break}a(h);var f=this.disjunction();return this.consumeChar(")"),{type:h,value:f,loc:this.loc(l)}}d()},t.prototype.quantifier=function(l){var h,f=this.idx;switch(this.popChar()){case"*":h={atLeast:0,atMost:1/0};break;case"+":h={atLeast:1,atMost:1/0};break;case"?":h={atLeast:0,atMost:1};break;case"{":var C=this.integerIncludingZero();switch(this.popChar()){case"}":h={atLeast:C,atMost:C};break;case",":var b;this.isDigit()?(b=this.integerIncludingZero(),h={atLeast:C,atMost:b}):h={atLeast:C,atMost:1/0},this.consumeChar("}");break}if(l===!0&&h===void 0)return;a(h);break}if(!(l===!0&&h===void 0))return a(h),this.peekChar(0)==="?"?(this.consumeChar("?"),h.greedy=!1):h.greedy=!0,h.type="Quantifier",h.loc=this.loc(f),h},t.prototype.atom=function(){var l,h=this.idx;switch(this.peekChar()){case".":l=this.dotAll();break;case"\\":l=this.atomEscape();break;case"[":l=this.characterClass();break;case"(":l=this.group();break}return l===void 0&&this.isPatternCharacter()&&(l=this.patternCharacter()),a(l),l.loc=this.loc(h),this.isQuantifier()&&(l.quantifier=this.quantifier()),l},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[s(`
|
|
1
|
+
"use strict";var Ir=Object.create;var vn=Object.defineProperty;var br=Object.getOwnPropertyDescriptor;var Cr=Object.getOwnPropertyNames;var yr=Object.getPrototypeOf,Br=Object.prototype.hasOwnProperty;var Tr=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Cr(e))!Br.call(i,r)&&r!==t&&vn(i,r,{get:()=>e[r],enumerable:!(n=br(e,r))||n.enumerable});return i};var wr=(i,e,t)=>(t=i!=null?Ir(yr(i)):{},Tr(e||!i||!i.__esModule?vn(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("three"),Kn=require("fflate");function Rr(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const oe=Rr(E);class Ae{x=0;y=0;z=0;constructor(e,t,n){typeof e=="number"?(this.x=e,this.y=t,this.z=n):typeof e>"u"?this.x=this.y=this.z=0:(this.x=e.x,this.y=e.y,this.z=e.z)}clone(){return new Ae(this)}write(e){e.x=this.x,e.y=this.y,e.z=this.z}normalize(){const e=this.x*this.x+this.y*this.y+this.z*this.z,t=Math.sqrt(e);return t!==0?(this.x/=t,this.y/=t,this.z/=t):console.warn("Vec3.normalize."),this}negate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}set(e,t,n){return typeof e=="number"?(this.x=e,this.y=t,this.z=n):(this.x=e.x,this.y=e.y,this.z=e.z),this}add(e,t,n){return typeof e=="number"?(this.x+=e,this.y+=t,this.z+=n):(this.x+=e.x,this.y+=e.y,this.z+=e.z),this}sub(e,t,n){return typeof e=="number"?(this.x-=e,this.y-=t,this.z-=n):(this.x-=e.x,this.y-=e.y,this.z-=e.z),this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}cross(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this}apply(e,t,n,r){let o,s,c,A;typeof e=="number"?(o=e,s=t,c=n,A=r):(o=e.x,s=e.y,c=e.z,A=e.w);const a=2*(s*this.z-c*this.y),d=2*(c*this.x-o*this.z),u=2*(o*this.y-s*this.x);return this.x+=A*a+s*u-c*d,this.y+=A*d+c*a-o*u,this.z+=A*u+o*d-s*a,this}lerp(e,t,n){this.x=(1-n)*e.x+n*t.x,this.y=(1-n)*e.y+n*t.y,this.z=(1-n)*e.z+n*t.z}}class Me{x=0;y=0;z=0;w=1;constructor(e,t,n,r){typeof e=="number"?(this.x=e,this.y=t,this.z=n,this.w=r):typeof e>"u"?(this.x=this.y=this.z=0,this.w=1):(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w)}clone(){return new Me(this)}write(e){e.x=this.x,e.y=this.y,e.z=this.z,e.w=this.w}normalize(){const e=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w,t=Math.sqrt(e);return t!==0?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):console.warn("Quat.normalize."),this}conjugate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}set(e,t,n,r){return typeof e=="number"?(this.x=e,this.y=t,this.z=n,this.w=r):(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w),this}mul(e,t,n,r){const o=this.x,s=this.y,c=this.z,A=this.w;let a,d,u,m;return typeof e=="number"?(a=e,d=t,u=n,m=r):(a=e.x,d=e.y,u=e.z,m=e.w),this.x=A*a+o*m+s*u-c*d,this.y=A*d-o*u+s*m+c*a,this.z=A*u+o*d-s*a+c*m,this.w=A*m-o*a-s*d-c*u,this}lerp(e,t,n){this.x=(1-n)*e.x+n*t.x,this.y=(1-n)*e.y+n*t.y,this.z=(1-n)*e.z+n*t.z,this.w=(1-n)*e.w+n*t.w}slerp(e,t,n){if(n<0||n>1){console.warn("Quat.slerp(): t must be in [0,1]");return}let r=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(Xe.set(t),r<0&&(r*=-1,Xe.set(-Xe.x,-Xe.y,-Xe.z,-Xe.w)),r>.9995){this.x=(1-n)*e.x+n*Xe.x,this.y=(1-n)*e.y+n*Xe.y,this.z=(1-n)*e.z+n*Xe.z,this.w=(1-n)*e.w+n*Xe.w;const o=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);o<1e-4?(console.warn("Quat.slerp(); ???!"),this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):(this.x*=1/o,this.y*=1/o,this.z*=1/o,this.w*=1/o)}else{const o=Math.acos(r),s=Math.sin((1-n)*o)/Math.sin(o),c=Math.sin(n*o)/Math.sin(o);this.x=s*e.x+c*Xe.x,this.y=s*e.y+c*Xe.y,this.z=s*e.z+c*Xe.z,this.w=s*e.w+c*Xe.w}}}const Xe=new Me;function At(i,e,t,n){t.normalize();const r=i.clone().sub(e).normalize(),o=new Ae().cross(r,t).normalize(),s=new Ae().cross(o,r),c=o.x,A=s.x,a=-r.x,d=o.y,u=s.y,m=-r.y,p=o.z,I=s.z,g=-r.z;let l,h,f,C;const b=c+u+g;if(b>0){const R=Math.sqrt(b+1)*2;l=(I-m)/R,h=(a-p)/R,f=(d-A)/R,C=.25*R}else if(c>u&&c>g){const R=Math.sqrt(1+c-u-g)*2;l=.25*R,h=(A+d)/R,f=(a+p)/R,C=(I-m)/R}else if(u>g){const R=Math.sqrt(1+u-c-g)*2;l=(A+d)/R,h=.25*R,f=(m+I)/R,C=(a-p)/R}else{const R=Math.sqrt(1+g-c-u)*2;l=(a+p)/R,h=(m+I)/R,f=.25*R,C=(d-A)/R}const y=n??new Me;return y.set(l,h,f,C),y}function ht(i,e="ZXY",t){const n=t!==void 0?t.set(0,0,0,1):new Me(0,0,0,1);for(let r=0;r<3;r++)switch(e.charAt(r)){case"X":n.mul(Math.sin(i.x),0,0,Math.cos(i.x));break;case"Y":n.mul(0,Math.sin(i.y),0,Math.cos(i.y));break;case"Z":n.mul(0,0,Math.sin(i.z),Math.cos(i.z));break}return n}function vr(i){const e=[[],[],[]],t=i.x+i.x,n=i.y+i.y,r=i.z+i.z,o=i.x*t,s=i.x*n,c=i.x*r,A=i.y*n,a=i.y*r,d=i.z*r,u=i.w*t,m=i.w*n,p=i.w*r;return e[0][0]=1-(A+d),e[0][1]=s-p,e[0][2]=c+m,e[1][0]=s+p,e[1][1]=1-(o+d),e[1][2]=a-u,e[2][0]=c-m,e[2][1]=a+u,e[2][2]=1-(o+A),e}const gt=i=>Math.max(-1,Math.min(1,i));function Qn(i,e="ZXY",t){const n=vr(i),r=t??new Ae;let o=0,s=0,c=0;switch(e){case"XYZ":s=Math.asin(gt(n[0][2])),Math.abs(n[0][2])<.9999999?(o=Math.atan2(-n[1][2],n[2][2]),c=Math.atan2(-n[0][1],n[0][0])):(o=Math.atan2(n[2][1],n[1][1]),c=0);break;case"YXZ":o=Math.asin(-gt(n[1][2])),Math.abs(n[1][2])<.9999999?(s=Math.atan2(n[0][2],n[2][2]),c=Math.atan2(n[1][0],n[1][1])):(s=Math.atan2(-n[2][0],n[0][0]),c=0);break;case"ZXY":o=Math.asin(gt(n[2][1])),Math.abs(n[2][1])<.9999999?(s=Math.atan2(-n[2][0],n[2][2]),c=Math.atan2(-n[0][1],n[1][1])):(s=0,c=Math.atan2(n[1][0],n[0][0]));break;case"ZYX":s=Math.asin(-gt(n[2][0])),Math.abs(n[2][0])<.9999999?(o=Math.atan2(n[2][1],n[2][2]),c=Math.atan2(n[1][0],n[0][0])):(o=0,c=Math.atan2(-n[0][1],n[1][1]));break;case"YZX":c=Math.asin(gt(n[1][0])),Math.abs(n[1][0])<.9999999?(o=Math.atan2(-n[1][2],n[1][1]),s=Math.atan2(-n[2][0],n[0][0])):(o=0,s=Math.atan2(n[0][2],n[2][2]));break;case"XZY":c=Math.asin(-gt(n[0][1])),Math.abs(n[0][1])<.9999999?(o=Math.atan2(n[2][1],n[1][1]),s=Math.atan2(n[0][2],n[0][0])):(o=Math.atan2(-n[1][2],n[2][2]),s=0);break}return r.set(o,s,c),r}class ze{loc;quat;scale;constructor(){this.loc=new Ae,this.quat=new Me,this.scale=new Ae(1,1,1)}set(e){return e instanceof ze?(this.loc.set(e.loc),this.quat.set(e.quat),this.scale.set(e.scale)):(e.getPosition(this.loc),e.getQuat(this.quat),e.getScale(this.scale)),this}write(e){e instanceof Oe?(e.object3D.position.set(this.loc.x,this.loc.y,this.loc.z),e.object3D.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.object3D.scale.set(this.scale.x,this.scale.y,this.scale.z)):(e.position.set(this.loc.x,this.loc.y,this.loc.z),e.quaternion.set(this.quat.x,this.quat.y,this.quat.z,this.quat.w),e.scale.set(this.scale.x,this.scale.y,this.scale.z))}blend(e,t){return this.loc.lerp(this.loc,e.loc,t),this.quat.slerp(this.quat,e.quat,t),this.scale.lerp(this.scale,e.scale,t),this}clone(){const e=new ze;return e.set(this),e}}class Rt{transform;constructor(){this.transform=new ze}init(e,t){this.transform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){this.transform.loc.set(e)}setPositionNow(e){this.transform.loc.set(e)}setQuat(e){this.transform.quat.set(e)}setQuatNow(e){this.transform.quat.set(e)}setScale(e){this.transform.scale.set(e)}setScaleNow(e){this.transform.scale.set(e)}setLinearVelocity(e){}getLinearVelocity(e){return e||new Ae}setAngularVelocity(e){}getAngularVelocity(e){return e||new Ae}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}}class Wn{transform;constructor(){this.transform=new ze}init(e,t){this.transform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){}setPositionNow(e){}setQuat(e){}setQuatNow(e){}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||new Ae}setAngularVelocity(e){}getAngularVelocity(e){return e||new Ae}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}update(e){}}class fn{startTransform;transform;endTransform;currentTime;duration;constructor(){this.startTransform=new ze,this.transform=new ze,this.endTransform=new ze,this.currentTime=0,this.duration=1}init(e,t){this.startTransform.set(e),this.transform.set(e),this.endTransform.set(e)}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}isGrounded(){return this.transform.loc.y<=0}setPosition(e){this.startTransform.set(this.transform),this.endTransform.loc.set(e),this.currentTime=0}setPositionNow(e){this.setPosition(e),this.currentTime=1}setQuat(e){this.startTransform.set(this.transform),this.endTransform.quat.set(e),this.currentTime=0}setQuatNow(e){this.setQuat(e),this.currentTime=1}setScale(e){this.startTransform.set(this.transform),this.endTransform.scale.set(e),this.currentTime=0}setScaleNow(e){this.setScale(e),this.currentTime=1}setLinearVelocity(e){}getLinearVelocity(e){e||(e=new Ae);const t=this.endTransform.loc.x-this.startTransform.loc.x,n=this.endTransform.loc.y-this.startTransform.loc.y,r=this.endTransform.loc.z-this.startTransform.loc.z;e.set(t,n,r);const o=this.currentTime<this.duration?this.currentTime:this.duration;return e.scale((-6*o*o+6*o)/this.duration),e}setAngularVelocity(e){}getAngularVelocity(e){e||(e=new Ae),Qn(this.startTransform.quat,"ZXY",_t),Qn(this.endTransform.quat,"ZXY",Dt),e.set(Dt.x-_t.x,Dt.y-_t.y,Dt.z-_t.z);const t=this.currentTime<this.duration?this.currentTime:this.duration;return e.scale((-6*t*t+6*t)/this.duration),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}smoothstep(e){return e*e*(3-2*e)}update(e){this.currentTime+=e,this.currentTime>this.duration&&(this.currentTime=this.duration);const t=this.currentTime/this.duration,n=this.smoothstep(t);this.transform.set(this.startTransform),this.transform.blend(this.endTransform,n)}}const ot=new Ae,yt=new Ae,ft=new Me,Lt=new ze,_t=new Ae,Dt=new Ae,Qr={up:new Ae(0,1,0)};class Yn extends Rt{up;target;constructor(e){super();const t={...Qr,...e};this.target=t.target,this.up=t.up}setTarget(e){this.target=e}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=Oe.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){ot.set(this.transform.loc),this.target.getPosition(yt),At(ot,yt,this.up,ft),this.transform.quat.set(ft)}}const kr={up:new Ae(0,1,0)};class Jn extends fn{up;target;constructor(e){super();const t={...kr,...e};this.target=t.target,this.up=t.up}init(e,t){super.init(e,t),t.upVector?this.up=t.upVector:this.up=Oe.defaultUpVector}setQuat(e){}setQuatNow(e){}update(e){super.update(e),ot.set(this.transform.loc),this.target.getPosition(yt),At(ot,yt,this.up,ft),this.transform.quat.set(ft)}}const Xn={lookFrom:{x:0,y:5,z:-10},smoothness:.9};class Zn extends Wn{target;lookFrom;up;smoothness;constructor(e){super();const t={...Xn,...e};this.target=t.target,this.lookFrom=new Ae(t.lookFrom),this.target.upVector?this.up=this.target.upVector:this.up=Oe.defaultUpVector,this.smoothness=t.smoothness}init(e,t){super.init(e,t)}update(e){super.update(e),ot.set(this.transform.loc),this.target.getPosition(yt),At(ot,yt,this.up,ft),ft.mul(0,1,0,0),Lt.quat.set(ft),ot.set(this.lookFrom),ot.apply(this.target.getQuat()),ot.add(this.target.getPosition()),Lt.loc.set(ot),this.transform.loc.lerp(this.transform.loc,Lt.loc,1-this.smoothness),this.transform.quat.slerp(this.transform.quat,Lt.quat,1-this.smoothness)}}const $n={rigidBody:"dynamic",collider:"solid",meshCollider:"convex_hull",mass:1,friction:.5,restitution:.5,membership:1,filter:1,collisionDetection:!1};function ei(i){return typeof i=="string"}function pn(i){return i.isMesh===!0}function Sr(i){return i.type==="RoundedBoxGeometry"}function xr(i){return i.type==="BoxGeometry"}function Lr(i){return i.type==="SphereGeometry"}function _r(i){return i.type==="IcosahedronGeometry"}function Dr(i){return i.type==="CylinderGeometry"}function Nr(i){return i.type==="CapsuleGeometry"}function Fr(i){return i.isBone===!0}function Or(i){return i.isPerspectiveCamera===!0}let je;const it=new Map;class vt{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!vt.RAPIER){const e=await import("@dimforge/rapier3d-compat");await e.init(),vt.RAPIER=e,je=e,this.isInitialized=!0}}createWorld(e){let t=.016666666666666666;this.isRapierWorldOptions(e)&&(t=e.timestep);const n=new je.World(e.gravity);return new gn(n,t)}isRapierWorldOptions(e){return"timestep"in e}}class gn{world;timestep;collisionEventQueue;constructor(e,t){this.world=e,this.timestep=t,this.collisionEventQueue=new je.EventQueue(!0),this.world.integrationParameters.dt=this.timestep}add(e){e.addOneselfToPhysics(this)}remove(e){e.removeOneselfFromPhysics(this)}update(e){const t=Math.ceil(e/this.timestep);for(let n=0;n<t;n++)this.world.step(this.collisionEventQueue)}getCollisions(){const e=[];return this.collisionEventQueue.drainCollisionEvents((t,n,r)=>{const o=it.get(t),s=it.get(n);o&&s&&e.push({objectA:o,partOfA:t,objectB:s,partOfB:n,started:r})}),e}}class kn{transform;objectA3;bodyDesc;body;colliderDescs;colliders;completeOptions;constructor(e={}){this.completeOptions={...$n,...e},this.transform=new ze,this.colliderDescs=[],this.colliders=[]}makeBodyDesc(){let e;switch(this.completeOptions.rigidBody){case"dynamic":e=je.RigidBodyDesc.dynamic();break;case"kinematic":e=je.RigidBodyDesc.kinematicPositionBased();break;case"fixed":e=je.RigidBodyDesc.fixed();break}return e.setTranslation(this.transform.loc.x,this.transform.loc.y,this.transform.loc.z),e.setRotation({x:this.transform.quat.x,y:this.transform.quat.y,z:this.transform.quat.z,w:this.transform.quat.w}),e}configColliderDescs(){if(!this.objectA3)return;const e=this.completeOptions,t=[];this.objectA3.object3D.traverse(r=>{if(pn(r)){const o=Gr(r.geometry),s=e.membership<<16|e.filter;if(o)o.colliderDesc.setCollisionGroups(s),e.collisionDetection&&o.colliderDesc.setActiveEvents(je.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(o.colliderDesc),o.colliderDesc.setRestitution(e.restitution).setFriction(e.friction),t.push(o.volume);else{let c,A;switch(e.meshCollider){case"tri_mesh":c=Mr(r),A=Sn(r.geometry);break;case"convex_hull":c=Pr(r),A=Sn(r.geometry);break}c&&(c.setCollisionGroups(s),e.collisionDetection&&c.setActiveEvents(je.ActiveEvents.COLLISION_EVENTS),this.colliderDescs.push(c),t.push(A))}}});let n=t.reduce((r,o)=>r+o,0);for(let r=0;r<this.colliderDescs.length;r++)this.colliderDescs[r].setRestitution(e.restitution),this.colliderDescs[r].setFriction(e.friction),this.colliderDescs[r].setMass(e.mass*(t[r]/n))}init(e,t){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)}addOneselfToPhysics(e){this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.colliderDescs.forEach(t=>{const n=e.world.createCollider(t,this.body);this.colliders.push(n),this.objectA3&&it.set(n.handle,this.objectA3)}),this.body.setTranslation(this.transform.loc,!0),this.body.setRotation(this.transform.quat,!0))}removeOneselfFromPhysics(e){this.colliders.forEach(t=>{e.world.removeCollider(t,!0),it.delete(t.handle)}),this.body&&e.world.removeRigidBody(this.body)}isGrounded(){return this.transform.loc.y<=0}setPosition(e){}setPositionNow(e){this.body?this.body.setTranslation(e,!0):this.bodyDesc?.setTranslation(e.x,e.y,e.z),this.transform.loc.set(e)}setQuat(e){}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}getLinearVelocity(e){return e||(e=new Ae),this.body?e.set(this.body.linvel()):this.bodyDesc&&e.set(this.bodyDesc.linvel),e}setAngularVelocity(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}getAngularVelocity(e){return e||(e=new Ae),this.body?e.set(this.body.angvel()):this.bodyDesc&&e.set(this.bodyDesc.angvel),e}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}update(e){if(this.body){const t=this.body.translation();this.transform.loc.set(t.x,t.y,t.z);const n=this.body.rotation();this.transform.quat.set(n.x,n.y,n.z,n.w)}}}function Mr(i){let e=null;if(pn(i)){const t=i;t.updateWorldMatrix(!0,!0);const n=t.geometry.clone();n.applyMatrix4(t.matrixWorld);const r=n.attributes.position.array;let o=n.index?n.index.array:null;if(o)o instanceof Uint32Array||(o=new Uint32Array(o));else{const s=n.attributes.position.count;o=new Uint32Array(s);for(let c=0;c<s;c++)o[c]=c}r instanceof Float32Array&&(e=je.ColliderDesc.trimesh(r,o))}return e}function Pr(i){let e=null;if(pn(i)){const t=i;t.updateWorldMatrix(!0,!0);const n=t.geometry.clone();n.applyMatrix4(t.matrixWorld);const r=n.attributes.position.array;r instanceof Float32Array&&(e=je.ColliderDesc.convexHull(r))}return e}function Sn(i){const e=i.attributes.position;if(!e)throw new Error("position attribute not found");const t=i.index,n=e.array;let r=0;const o=new oe.Vector3,s=new oe.Vector3,c=new oe.Vector3;if(t){const A=t.array;for(let a=0;a<A.length;a+=3){const d=A[a]*3,u=A[a+1]*3,m=A[a+2]*3;o.set(n[d],n[d+1],n[d+2]),s.set(n[u],n[u+1],n[u+2]),c.set(n[m],n[m+1],n[m+2]),r+=o.dot(s.clone().cross(c))}}else for(let A=0;A<n.length;A+=9)o.set(n[A],n[A+1],n[A+2]),s.set(n[A+3],n[A+4],n[A+5]),c.set(n[A+6],n[A+7],n[A+8]),r+=o.dot(s.clone().cross(c));return Math.abs(r)/6}function Gr(i){if(Sr(i)){const e=i.parameters,t=typeof e?.width=="number"?e.width/2:.5,n=typeof e?.height=="number"?e.height/2:.5,r=typeof e?.depth=="number"?e.depth/2:.5,o=.1;return{colliderDesc:je.ColliderDesc.roundCuboid(t-o,n-o,r-o,o),volume:2*t*2*n*2*r}}else if(xr(i)){const e=i.parameters,t=typeof e?.width=="number"?e.width/2:.5,n=typeof e?.height=="number"?e.height/2:.5,r=typeof e?.depth=="number"?e.depth/2:.5;return{colliderDesc:je.ColliderDesc.cuboid(t,n,r),volume:2*t*2*n*2*r}}else if(Lr(i)){const e=i.parameters,t=typeof e?.radius=="number"?e.radius:1;return{colliderDesc:je.ColliderDesc.ball(t),volume:4/3*Math.PI*t*t*t}}else if(_r(i)){const e=i.parameters,t=typeof e?.radius=="number"?e.radius:1;return{colliderDesc:je.ColliderDesc.ball(t),volume:4/3*Math.PI*t*t*t}}else if(Dr(i)){const e=i.parameters,t=typeof e?.radiusBottom=="number"?e.radiusBottom:.5,n=typeof e?.height=="number"?e.height:.5;return{colliderDesc:je.ColliderDesc.cylinder(n/2,t),volume:Math.PI*t*t*n}}else if(Nr(i)){const e=i.parameters,t=typeof e?.radius=="number"?e.radius:.5,n=typeof e?.height=="number"?e.height:.5;return{colliderDesc:je.ColliderDesc.capsule(n/2,t),volume:4/3*Math.PI*t*t*t+Math.PI*t*t*n}}return null}const on=new vt;async function Ur(){await on.init()}const _={v0:new Ae,v1:new Ae,v2:new Ae,v3:new Ae,v4:new Ae,q0:new Me,q1:new Me,q2:new Me,q3:new Me,q4:new Me,t0:new ze,t1:new ze,t2:new ze,t3:new ze,t4:new ze};function jr(i){return new Promise(e=>{setTimeout(()=>{e()},i)})}async function ti(i){const t=await(await fetch(i)).arrayBuffer(),n=await new Promise((r,o)=>{Kn.unzip(new Uint8Array(t),(s,c)=>{s?o(s):r(c)})});return{zipUrl:i,unzipped:n}}function Nt(i,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),i.unzipped[e])return Kn.strFromU8(i.unzipped[e]);throw new Error(`readStringFromUnzippedA3(): no file at ${e}`)}function sn(i,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),i.unzipped[e]){const t=qr(e);return new Blob([new Uint8Array(i.unzipped[e])],{type:t})}else throw new Error(`readBlobFromUnzippedA3(): no file at ${e}`)}const Hr={"image/png":/\.png$/i,"image/jpeg":/\.(jpg|jpeg)$/i,"image/gif":/\.gif$/i,"model/vrml":/\.wrl$/i,"application/xml":/\.xml$/i,"application/octet-stream":/\.bvh/i,"audio/x-wav":/\.wav/i,"audio/mpeg":/\.mp3/i,"audio/ogg":/\.ogg/i,"text/plain":/\.(txt|text)$/i,"model/gltf+json":/\.gltf$/i,"model/gltf-binary":/\.glb$/i};function qr(i){for(const[e,t]of Object.entries(Hr))if(t.test(i))return e;return"application/octet-stream"}function Ot(i,e){if(!e)return i;const t={...i};for(const n in e)typeof i[n]=="object"&&typeof e[n]=="object"?t[n]=Ot(i[n],e[n]):t[n]=e[n];return t}const ni={offset:.01,auto:!0,height:1.5,radius:.3};class ii{transform;objectA3;completeOptions;controller;colliderDesc;collider;capsuleCenter;nextLocation;tmpV1;tmpV2;tmpQ1;constructor(e={}){this.completeOptions={...ni,...e},this.transform=new ze,this.capsuleCenter=new Ae,this.nextLocation=new Ae,this.tmpV1=new Ae,this.tmpV2=new Ae,this.tmpQ1=new Me}init(e,t){if(this.transform.set(e),this.completeOptions.auto){const n=new oe.Vector3,r=new oe.Quaternion,o=new oe.Object3D;o.add(t.object3D),t.getPosition(this.tmpV1),this.tmpV1.write(n),o.position.set(n.x,n.y,n.z),t.getQuat(this.tmpQ1),this.tmpQ1.write(r),o.quaternion.set(r.x,r.y,r.z,r.w),t.getScale(this.tmpV2),this.tmpV2.write(n),o.scale.set(n.x,n.y,n.z);const s=new oe.Box3().setFromObject(o);o.remove(t.object3D),s.getSize(n),this.completeOptions.radius=Math.max(n.x,n.z)/2,this.completeOptions.height=n.y-this.completeOptions.radius*2,s.getCenter(n),this.capsuleCenter.set(n)}this.colliderDesc=je.ColliderDesc.capsule(this.completeOptions.height,this.completeOptions.radius),this.colliderDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.colliderDesc.setRotation({x:e.quat.x,y:e.quat.y,z:e.quat.z,w:e.quat.w})}addOneselfToPhysics(e){this.controller=e.world.createCharacterController(this.completeOptions.offset),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc)),this.collider&&this.objectA3&&it.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.collider&&(e.world.removeCollider(this.collider,!1),it.delete(this.collider.handle))}setPosition(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.nextLocation.set(this.tmpV1)}setPositionNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.collider&&this.collider.setTranslation(this.tmpV1),this.transform.loc.set(e),this.nextLocation.set(this.tmpV1)}setQuat(e){this.collider&&this.collider.setRotation(e),this.transform.quat.set(e)}setQuatNow(e){this.collider&&this.collider.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||(e=new Ae),e.set(0,0,0),e}setAngularVelocity(e){}getAngularVelocity(e){return e||(e=new Ae),e.set(0,0,0),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}isGrounded(){return this.controller?this.controller.computedGrounded():!1}update(e){if(!this.controller||!this.collider)return;this.transform.quat.set(this.collider.rotation()),this.tmpV1.set(this.collider.translation()),this.tmpV2.set(this.nextLocation),this.tmpV2.sub(this.tmpV1),this.controller.computeColliderMovement(this.collider,this.tmpV2);const t=this.controller.computedMovement();this.tmpV1.add(t),this.collider.setTranslation(this.tmpV1),this.tmpV1.sub(this.capsuleCenter),this.transform.loc.set(this.tmpV1),this.nextLocation.set(this.tmpV1)}}const ri={auto:!0,height:1.5,radius:.3};class oi{transform;objectA3;completeOptions;colliderDesc;collider;bodyDesc;body;capsuleCenter;tmpV1;tmpV2;tmpQ1;physicsWorld;constructor(e={}){this.completeOptions={...ri,...e},this.transform=new ze,this.capsuleCenter=new Ae,this.tmpV1=new Ae,this.tmpV2=new Ae,this.tmpQ1=new Me}init(e,t){if(this.transform.set(e),this.completeOptions.auto){const n=new oe.Vector3,r=new oe.Quaternion,o=new oe.Object3D;o.add(t.object3D),t.getPosition(this.tmpV1),this.tmpV1.write(n),o.position.set(n.x,n.y,n.z),t.getQuat(this.tmpQ1),this.tmpQ1.write(r),o.quaternion.set(r.x,r.y,r.z,r.w),t.getScale(this.tmpV2),this.tmpV2.write(n),o.scale.set(n.x,n.y,n.z);const s=new oe.Box3().setFromObject(o);s.getSize(n),this.completeOptions.radius=Math.max(n.x,n.z)/2,this.completeOptions.height=n.y-this.completeOptions.radius*2,s.getCenter(n),this.capsuleCenter.set(n)}this.bodyDesc=je.RigidBodyDesc.dynamic(),this.bodyDesc.setTranslation(e.loc.x,e.loc.y,e.loc.z),this.bodyDesc.setRotation(e.quat),this.colliderDesc=je.ColliderDesc.capsule(this.completeOptions.height,this.completeOptions.radius)}addOneselfToPhysics(e){this.physicsWorld=e,this.bodyDesc&&(this.body=e.world.createRigidBody(this.bodyDesc),this.body.setEnabledRotations(!1,!1,!1,!0),this.body.setTranslation(this.transform.loc,!0),this.body.setRotation(this.transform.quat,!0)),this.colliderDesc&&(this.collider=e.world.createCollider(this.colliderDesc,this.body)),this.collider&&this.objectA3&&it.set(this.collider.handle,this.objectA3)}removeOneselfFromPhysics(e){this.collider&&(e.world.removeCollider(this.collider,!0),it.delete(this.collider.handle)),this.body&&e.world.removeRigidBody(this.body),this.physicsWorld=void 0}setPosition(e){}setPositionNow(e){this.tmpV1.set(e),this.tmpV1.add(this.capsuleCenter),this.body?this.body.setTranslation(this.tmpV1,!0):this.bodyDesc?.setTranslation(this.tmpV1.x,this.tmpV1.y,this.tmpV1.z),this.transform.loc.set(e)}setQuat(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setQuatNow(e){this.body?this.body.setRotation(e,!0):this.bodyDesc?.setRotation(e),this.transform.quat.set(e)}setScale(e){}setScaleNow(e){}setLinearVelocity(e){this.body?this.body.setLinvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setLinvel(e.x,e.y,e.z)}getLinearVelocity(e){return e||(e=new Ae),this.body?e.set(this.body.linvel()):this.bodyDesc&&e.set(this.bodyDesc.linvel),e}setAngularVelocity(e){this.body?this.body.setAngvel({x:e.x,y:e.y,z:e.z},!0):this.bodyDesc?.setAngvel({x:e.x,y:e.y,z:e.z})}getAngularVelocity(e){return e||(e=new Ae),this.body?e.set(this.body.angvel()):this.bodyDesc&&e.set(this.bodyDesc.angvel),e}resetForce(){this.body?.resetForces(!0)}addForce(e){this.body?.addForce({x:e.x,y:e.y,z:e.z},!0)}addForceAtPoint(e,t){this.body?.addForceAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}resetTorque(){this.body?.resetTorques(!0)}addTorque(e){this.body?.addTorque({x:e.x,y:e.y,z:e.z},!0)}applyImpulse(e){this.body?.applyImpulse({x:e.x,y:e.y,z:e.z},!0)}applyImpulseAtPoint(e,t){this.body?.applyImpulseAtPoint({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z},!0)}applyTorqueImpulse(e){this.body?.applyTorqueImpulse({x:e.x,y:e.y,z:e.z},!0)}isGrounded(){if(this.body&&this.physicsWorld){const e=this.body.translation(),t=new je.Ray(e,{x:0,y:-1,z:0}),n=1.1*(this.completeOptions.height+this.completeOptions.radius);return this.physicsWorld.world.castRay(t,n,!0,void 0,void 0,this.collider)!==null}else return this.transform.loc.y<=0}update(e){if(!this.body)return;const t=new Ae(this.body.translation());t.sub(this.capsuleCenter),this.transform.loc.set(t),this.transform.quat.set(this.body.rotation())}}const zr=new oe.SphereGeometry,Vr=new oe.MeshStandardMaterial({color:16711680});let Kr=new oe.Mesh(zr,Vr);class Oe{static defaultRotationOrder="ZXY";static defaultUpVector=new Ae(0,1,0);rotationOrder;upVector;object3D;scene;balloon;transformer;parent;children=[];clickListener;constructor(e){this.transformer=this.initTransformer(e),this.object3D=new oe.Object3D;const t=this.initObject(e);t&&this.object3D.add(t),this.object3D.traverse(n=>{n.userData.a3js={objectA3:this}})}initObject(e){return Kr.clone()}initTransformer(e){return new Rt}setTransformer(e){_.t0.set(this.transformer.transform),e.init(_.t0,this),this.transformer=e}getTransformer(){return this.transformer}setTransformMode(e,t){e==="Default"?this.setTransformer(new Rt):e==="Smooth"?this.setTransformer(new fn):e==="Follow"?this.setTransformer(new Zn(t)):e==="Billboard"?this.setTransformer(new Yn(t)):e==="SmoothBillboard"?this.setTransformer(new Jn(t)):e==="SimplePhysics"?this.setTransformer(new kn(t)):e==="KinematicCharacter"?this.setTransformer(new ii(t)):e==="DynamicCharacter"&&this.setTransformer(new oi(t))}initSimplePhysics(e){const t={...$n,...e};this.setTransformer(new kn(t))}update(e){this.transformer.update(e),this.transformer.transform.write(this),this.children.forEach(t=>{t.update(e)})}add(e){if(e.scene){console.warn("ObjectA3.add(obj) is ignored.");return}if(e.parent){console.warn("ObjectA3.add(obj) is ignored.");return}this.children.push(e),e.parent=this,this.object3D.add(e.object3D)}remove(e){if(e.parent!==this){console.warn("ObjectA3.remove(obj) is ignored.");return}const t=this.children.indexOf(e);this.children.splice(t,1),e.parent=void 0,this.object3D.remove(e.object3D)}setSpeechBubble(e){this.balloon?this.balloon.message=e:this.balloon=new Wr(e)}setClickListener(e){this.clickListener=e}handleCollision(e,t,n,r){}async clicked(){this.clickListener&&await this.clickListener(this)}getPosition(e){return e?(e.set(this.transformer.transform.loc),e):this.transformer.transform.loc.clone()}setPosition(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setPosition(_.v0)}setPositionNow(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setPositionNow(_.v0)}getQuat(e){return e?(e.set(this.transformer.transform.quat),e):this.transformer.transform.quat.clone()}setQuat(e,t,n,r){typeof e=="number"?_.q0.set(e,t,n,r):_.q0.set(e),this.transformer.setQuat(_.q0)}setQuatNow(e,t,n,r){typeof e=="number"?_.q0.set(e,t,n,r):_.q0.set(e),this.transformer.setQuatNow(_.q0)}getScale(e){return e?(e.set(this.transformer.transform.scale),e):this.transformer.transform.scale.clone()}setScale(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setScale(_.v0)}setScaleNow(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setScaleNow(_.v0)}setRotation(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),_.v0.scale(Math.PI/360);const r=this.rotationOrder?this.rotationOrder:Oe.defaultRotationOrder;ht(_.v0,r,_.q1),this.setQuat(_.q1)}setRotationNow(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),_.v0.scale(Math.PI/360);const r=this.rotationOrder?this.rotationOrder:Oe.defaultRotationOrder;ht(_.v0,r,_.q0),this.setQuatNow(_.q0)}lookAt(e,t,n){typeof e=="number"?_.v1.set(e,t,n):e instanceof Oe?_.v1.set(e.transformer.transform.loc):_.v1.set(e);const r=this.upVector?this.upVector:Oe.defaultUpVector;At(this.transformer.transform.loc,_.v1,r,_.q1),this.setQuat(_.q1)}lookAtNow(e,t,n){typeof e=="number"?_.v1.set(e,t,n):e instanceof Oe?_.v1.set(e.transformer.transform.loc):_.v1.set(e);const r=this.upVector?this.upVector:Oe.defaultUpVector;At(this.transformer.transform.loc,_.v1,r,_.q1),this.setQuatNow(_.q1)}getUnitVecX(e){return e?(e.set(1,0,0),e.apply(this.object3D.quaternion)):new Ae(1,0,0).apply(this.object3D.quaternion)}getUnitVecY(e){return e?(e.set(0,1,0),e.apply(this.object3D.quaternion)):new Ae(0,1,0).apply(this.object3D.quaternion)}getUnitVecZ(e){return e?(e.set(0,0,1),e.apply(this.object3D.quaternion)):new Ae(0,0,1).apply(this.object3D.quaternion)}translate(e,t,n){_.v1.set(this.transformer.transform.loc),typeof e=="number"?_.v1.add(e,t,n):_.v1.add(e),this.setPosition(_.v1)}translateNow(e,t,n){_.v1.set(this.transformer.transform.loc),typeof e=="number"?_.v1.add(e,t,n):_.v1.add(e),this.setPositionNow(_.v1)}mulQuat(e,t,n,r){_.q1.set(this.transformer.transform.quat),typeof e=="number"?_.q1.mul(e,t,n,r):_.q1.mul(e),this.setQuat(_.q1)}mulQuatNow(e,t,n,r){_.q1.set(this.transformer.transform.quat),typeof e=="number"?_.q1.mul(e,t,n,r):_.q1.mul(e),this.setQuatNow(_.q1)}mulRotation(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),_.v0.scale(Math.PI/360);const r=this.rotationOrder?this.rotationOrder:Oe.defaultRotationOrder;ht(_.v0,r,_.q1),this.getQuat(_.q0),_.q0.mul(_.q1),this.setQuat(_.q0)}mulRotationNow(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),_.v0.scale(Math.PI/360);const r=this.rotationOrder?this.rotationOrder:Oe.defaultRotationOrder;ht(_.v0,r,_.q1),this.getQuat(_.q0),_.q0.mul(_.q1),this.setQuatNow(_.q0)}scaleBy(e,t,n){this.getScale(_.v0),typeof e=="number"?_.v0.set(_.v0.x*e,_.v0.y*t,_.v0.z*n):_.v0.set(_.v0.x*e.x,_.v0.y*e.y,_.v0.z*e.z),this.setScale(_.v0)}mulScaleNow(e,t,n){this.getScale(_.v0),typeof e=="number"?_.v0.set(_.v0.x*e,_.v0.y*t,_.v0.z*n):_.v0.set(_.v0.x*e.x,_.v0.y*e.y,_.v0.z*e.z),this.setScaleNow(_.v0)}moveForward(e){this.getUnitVecZ(_.v0),_.v0.scale(e),this.translate(_.v0)}moveForwardNow(e){this.getUnitVecZ(_.v0),_.v0.scale(e),this.translateNow(_.v0)}moveBackward(e){this.getUnitVecZ(_.v0),_.v0.scale(-e),this.translate(_.v0)}moveBackwardNow(e){this.getUnitVecZ(_.v0),_.v0.scale(-e),this.translateNow(_.v0)}moveRight(e){this.getUnitVecX(_.v0),_.v0.scale(-e),this.translate(_.v0)}moveRightNow(e){this.getUnitVecX(_.v0),_.v0.scale(-e),this.translateNow(_.v0)}moveLeft(e){this.getUnitVecX(_.v0),_.v0.scale(e),this.translate(_.v0)}moveLeftNow(e){this.getUnitVecX(_.v0),_.v0.scale(e),this.translateNow(_.v0)}moveUp(e){this.getUnitVecY(_.v0),_.v0.scale(e),this.translate(_.v0)}moveUpNow(e){this.getUnitVecY(_.v0),_.v0.scale(e),this.translateNow(_.v0)}moveDown(e){this.getUnitVecY(_.v0),_.v0.scale(-e),this.translate(_.v0)}moveDownNow(e){this.getUnitVecY(_.v0),_.v0.scale(-e),this.translateNow(_.v0)}turnUp(e){this.mulRotation(-e,0,0)}turnUpNow(e){this.mulRotationNow(-e,0,0)}turnDown(e){this.mulRotation(e,0,0)}turnDownNow(e){this.mulRotationNow(e,0,0)}turnRight(e){this.mulRotation(0,-e,0)}turnRightNow(e){this.mulRotationNow(0,-e,0)}turnLeft(e){this.mulRotation(0,e,0)}turnLeftNow(e){this.mulRotationNow(0,e,0)}rollRight(e){this.mulRotation(0,0,e)}rollRightNow(e){this.mulRotationNow(0,0,e)}rollLeft(e){this.mulRotation(0,0,-e)}rollLeftNow(e){this.mulRotationNow(0,0,-e)}setLinearVelocity(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setLinearVelocity(_.v0)}getLinearVelocity(e){return this.transformer.getLinearVelocity(e)}setAngularVelocity(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.setAngularVelocity(_.v0)}getAngularVelocity(e){return this.transformer.getAngularVelocity(e)}resetForce(){this.transformer.resetForce()}addForce(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.addForce(_.v0)}addForceAtPoint(e,t,n,r,o,s){if(typeof e=="number")if(typeof t=="number")_.v0.set(e,t,n),_.v1.set(r,o,s);else{console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else if(typeof t=="number"){console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else _.v0.set(e),_.v1.set(t);this.transformer.addForceAtPoint(_.v0,_.v1)}resetTorque(){this.transformer.resetTorque()}addTorque(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.addTorque(_.v0)}applyImpulse(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.applyImpulse(_.v0)}applyImpulseAtPoint(e,t,n,r,o,s){if(typeof e=="number")if(typeof t=="number")_.v0.set(e,t,n),_.v1.set(r,o,s);else{console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else if(typeof t=="number"){console.warn("ObjectA3.addForceAtPoint(): type of arguments mismatch.");return}else _.v0.set(e),_.v1.set(t);this.transformer.applyImpulseAtPoint(_.v0,_.v1)}applyTorqueImpulse(e,t,n){typeof e=="number"?_.v0.set(e,t,n):_.v0.set(e),this.transformer.applyTorqueImpulse(_.v0)}addOneselfToPhysics(e){this.transformer.addOneselfToPhysics(e)}removeOneselfFromPhysics(e){this.transformer.removeOneselfFromPhysics(e)}isGrounded(){return this.transformer.isGrounded()}}class Wr{message;dir;offsetTop;offsetRight;offsetLeft;offsetBottom;constructor(e){this.message=e,this.dir="RIGHT",this.offsetTop={x:0,y:2},this.offsetRight={x:1,y:1},this.offsetLeft={x:-1,y:1},this.offsetBottom={x:0,y:0}}}class mn{shape;motion;constructor(e,t){this.shape=e,this.motion=t}enable(e,t){this.motion.playCount=0,this.motion.time=0,e.add(this.shape.root)}disable(e,t){e.remove(this.shape.root)}}class bt extends Oe{ready;actions;currentAction;stateAction;emoteAction;morphs;overwriteMorphs;constructor(e){super(e),this.actions={},this.morphs={},this.overwriteMorphs=!1,this.ready=this.asyncInit(e)}syncInit(e,t,n={}){this.actions=t,this.stateAction=this.actions[e],this.currentAction=this.stateAction,this.object3D.clear(),this.morphs=n,this.stateAction?.enable(this.object3D,this.scene)}setActions(e){this.actions=e}getAction(e){return this.actions[e]}addAction(e,t){this.actions[e]=t}removeAction(e){const t=this.actions[e];return delete this.actions[e],t}getActionNames(){return Object.keys(this.actions)}setState(e){const t=this.actions[e];t&&(this.currentAction&&this.currentAction.disable(this.object3D,this.scene),t.enable(this.object3D,this.scene),this.currentAction=t,this.stateAction=t)}setEmote(e){const t=this.actions[e];t&&(this.currentAction&&this.currentAction.disable(this.object3D,this.scene),t.enable(this.object3D,this.scene),this.currentAction=t,this.emoteAction=t)}setMorphsOverwrite(e){this.overwriteMorphs=e}setMorph(e,t){if(e in this.morphs){const{array:n,idx:r}=this.morphs[e];n[r]=t}}getMorphNames(){return Object.keys(this.morphs)}pose={};update(e){super.update(e);let t;if(this.emoteAction&&this.emoteAction.motion.playCount<=0?(t=this.emoteAction.motion.update(e),this.emoteAction.motion.playCount>0&&(this.emoteAction.disable(this.object3D,this.scene),this.emoteAction=void 0,this.stateAction&&(this.stateAction.enable(this.object3D,this.scene),this.currentAction=this.stateAction))):this.stateAction&&(t=this.stateAction.motion.update(e)),t&&this.currentAction&&this.currentAction.shape.bones)for(const[n,r]of Object.entries(t)){const o=this.currentAction.shape.bones[n];if(o&&(r.loc&&o.position.set(r.loc.x,r.loc.y,r.loc.z),r.quat&&o.quaternion.set(r.quat.x,r.quat.y,r.quat.z,r.quat.w),r.scale&&o.scale.set(r.scale.x,r.scale.y,r.scale.z)),!this.overwriteMorphs&&r.morphs){for(const s of r.morphs)for(const c of Object.keys(this.morphs))if(c.startsWith(s.name)){const{array:A}=this.morphs[c];for(let a=0;a<A.length;a++)A[a]=s.vals[a];break}}}this.object3D.updateMatrixWorld(!0),this.currentAction&&this.currentAction.shape.skeleton?.update()}}class xn{name;playCount;time;finishListener;constructor(){this.name="dummy",this.playCount=0,this.time=0}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setPause(e){}setTime(e){}setFinishListener(e){this.finishListener=e}update(e){return{}}}var Re=(i,e)=>()=>(e||(e={exports:{}},i(e.exports,e)),e.exports),si=Re(i=>{Object.defineProperty(i,"__esModule",{value:!0}),i.VERSION=void 0,i.VERSION="9.0.1"}),Ne=Re((i,e)=>{var t=i&&i.__spreadArray||function(O,X){for(var z=0,re=X.length,fe=O.length;z<re;z++,fe++)O[fe]=X[z];return O};Object.defineProperty(i,"__esModule",{value:!0}),i.toFastProperties=i.timer=i.peek=i.isES2015MapSupported=i.PRINT_WARNING=i.PRINT_ERROR=i.packArray=i.IDENTITY=i.NOOP=i.merge=i.groupBy=i.defaults=i.assignNoOverwrite=i.assign=i.zipObject=i.sortBy=i.indexOf=i.some=i.difference=i.every=i.isObject=i.isRegExp=i.isArray=i.partial=i.uniq=i.compact=i.reduce=i.findAll=i.find=i.cloneObj=i.cloneArr=i.contains=i.has=i.pick=i.reject=i.filter=i.dropRight=i.drop=i.isFunction=i.isUndefined=i.isString=i.forEach=i.last=i.first=i.flatten=i.map=i.mapValues=i.values=i.keys=i.isEmpty=void 0;function n(O){return O&&O.length===0}i.isEmpty=n;function r(O){return O==null?[]:Object.keys(O)}i.keys=r;function o(O){for(var X=[],z=Object.keys(O),re=0;re<z.length;re++)X.push(O[z[re]]);return X}i.values=o;function s(O,X){for(var z=[],re=r(O),fe=0;fe<re.length;fe++){var Qe=re[fe];z.push(X.call(null,O[Qe],Qe))}return z}i.mapValues=s;function c(O,X){for(var z=[],re=0;re<O.length;re++)z.push(X.call(null,O[re],re));return z}i.map=c;function A(O){for(var X=[],z=0;z<O.length;z++){var re=O[z];Array.isArray(re)?X=X.concat(A(re)):X.push(re)}return X}i.flatten=A;function a(O){return n(O)?void 0:O[0]}i.first=a;function d(O){var X=O&&O.length;return X?O[X-1]:void 0}i.last=d;function u(O,X){if(Array.isArray(O))for(var z=0;z<O.length;z++)X.call(null,O[z],z);else if($(O))for(var re=r(O),z=0;z<re.length;z++){var fe=re[z],Qe=O[fe];X.call(null,Qe,fe)}else throw Error("non exhaustive match")}i.forEach=u;function m(O){return typeof O=="string"}i.isString=m;function p(O){return O===void 0}i.isUndefined=p;function I(O){return O instanceof Function}i.isFunction=I;function g(O,X){return X===void 0&&(X=1),O.slice(X,O.length)}i.drop=g;function l(O,X){return X===void 0&&(X=1),O.slice(0,O.length-X)}i.dropRight=l;function h(O,X){var z=[];if(Array.isArray(O))for(var re=0;re<O.length;re++){var fe=O[re];X.call(null,fe)&&z.push(fe)}return z}i.filter=h;function f(O,X){return h(O,function(z){return!X(z)})}i.reject=f;function C(O,X){for(var z=Object.keys(O),re={},fe=0;fe<z.length;fe++){var Qe=z[fe],ye=O[Qe];X(ye)&&(re[Qe]=ye)}return re}i.pick=C;function b(O,X){return $(O)?O.hasOwnProperty(X):!1}i.has=b;function y(O,X){return q(O,function(z){return z===X})!==void 0}i.contains=y;function R(O){for(var X=[],z=0;z<O.length;z++)X.push(O[z]);return X}i.cloneArr=R;function x(O){var X={};for(var z in O)Object.prototype.hasOwnProperty.call(O,z)&&(X[z]=O[z]);return X}i.cloneObj=x;function q(O,X){for(var z=0;z<O.length;z++){var re=O[z];if(X.call(null,re))return re}}i.find=q;function v(O,X){for(var z=[],re=0;re<O.length;re++){var fe=O[re];X.call(null,fe)&&z.push(fe)}return z}i.findAll=v;function G(O,X,z){for(var re=Array.isArray(O),fe=re?O:o(O),Qe=re?[]:r(O),ye=z,le=0;le<fe.length;le++)ye=X.call(null,ye,fe[le],re?le:Qe[le]);return ye}i.reduce=G;function D(O){return f(O,function(X){return X==null})}i.compact=D;function Q(O,X){X===void 0&&(X=function(re){return re});var z=[];return G(O,function(re,fe){var Qe=X(fe);return y(z,Qe)?re:(z.push(Qe),re.concat(fe))},[])}i.uniq=Q;function F(O){for(var X=[],z=1;z<arguments.length;z++)X[z-1]=arguments[z];var re=[null],fe=re.concat(X);return Function.bind.apply(O,fe)}i.partial=F;function L(O){return Array.isArray(O)}i.isArray=L;function J(O){return O instanceof RegExp}i.isRegExp=J;function $(O){return O instanceof Object}i.isObject=$;function j(O,X){for(var z=0;z<O.length;z++)if(!X(O[z],z))return!1;return!0}i.every=j;function ee(O,X){return f(O,function(z){return y(X,z)})}i.difference=ee;function ne(O,X){for(var z=0;z<O.length;z++)if(X(O[z]))return!0;return!1}i.some=ne;function ue(O,X){for(var z=0;z<O.length;z++)if(O[z]===X)return z;return-1}i.indexOf=ue;function ie(O,X){var z=R(O);return z.sort(function(re,fe){return X(re)-X(fe)}),z}i.sortBy=ie;function Z(O,X){if(O.length!==X.length)throw Error("can't zipObject with different number of keys and values!");for(var z={},re=0;re<O.length;re++)z[O[re]]=X[re];return z}i.zipObject=Z;function se(O){for(var X=[],z=1;z<arguments.length;z++)X[z-1]=arguments[z];for(var re=0;re<X.length;re++)for(var fe=X[re],Qe=r(fe),ye=0;ye<Qe.length;ye++){var le=Qe[ye];O[le]=fe[le]}return O}i.assign=se;function de(O){for(var X=[],z=1;z<arguments.length;z++)X[z-1]=arguments[z];for(var re=0;re<X.length;re++)for(var fe=X[re],Qe=r(fe),ye=0;ye<Qe.length;ye++){var le=Qe[ye];b(O,le)||(O[le]=fe[le])}return O}i.assignNoOverwrite=de;function P(){for(var O=[],X=0;X<arguments.length;X++)O[X]=arguments[X];return de.apply(void 0,t([{}],O))}i.defaults=P;function H(O,X){var z={};return u(O,function(re){var fe=X(re),Qe=z[fe];Qe?Qe.push(re):z[fe]=[re]}),z}i.groupBy=H;function Y(O,X){for(var z=x(O),re=r(X),fe=0;fe<re.length;fe++){var Qe=re[fe],ye=X[Qe];z[Qe]=ye}return z}i.merge=Y;function V(){}i.NOOP=V;function K(O){return O}i.IDENTITY=K;function ce(O){for(var X=[],z=0;z<O.length;z++){var re=O[z];X.push(re!==void 0?re:void 0)}return X}i.packArray=ce;function Be(O){console&&console.error&&console.error("Error: "+O)}i.PRINT_ERROR=Be;function Te(O){console&&console.warn&&console.warn("Warning: "+O)}i.PRINT_WARNING=Te;function De(){return typeof Map=="function"}i.isES2015MapSupported=De;function Ve(O){return O[O.length-1]}i.peek=Ve;function Je(O){var X=new Date().getTime(),z=O(),re=new Date().getTime(),fe=re-X;return{time:fe,value:z}}i.timer=Je;function qe(O){function X(){}X.prototype=O;var z=new X;function re(){return typeof z.bar}return re(),re(),O}i.toFastProperties=qe}),En=Re((i,e)=>{(function(t,n){typeof define=="function"&&define.amd?define([],n):typeof e=="object"&&e.exports?e.exports=n():t.regexpToAst=n()})(typeof self<"u"?self:i,function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(l){this.idx=l.idx,this.input=l.input,this.groupIdx=l.groupIdx},t.prototype.pattern=function(l){this.idx=0,this.input=l,this.groupIdx=0,this.consumeChar("/");var h=this.disjunction();this.consumeChar("/");for(var f={type:"Flags",loc:{begin:this.idx,end:l.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":A(f,"global");break;case"i":A(f,"ignoreCase");break;case"m":A(f,"multiLine");break;case"u":A(f,"unicode");break;case"y":A(f,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:f,value:h,loc:this.loc(0)}},t.prototype.disjunction=function(){var l=[],h=this.idx;for(l.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),l.push(this.alternative());return{type:"Disjunction",value:l,loc:this.loc(h)}},t.prototype.alternative=function(){for(var l=[],h=this.idx;this.isTerm();)l.push(this.term());return{type:"Alternative",value:l,loc:this.loc(h)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var l=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(l)};case"$":return{type:"EndAnchor",loc:this.loc(l)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(l)};case"B":return{type:"NonWordBoundary",loc:this.loc(l)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var h;switch(this.popChar()){case"=":h="Lookahead";break;case"!":h="NegativeLookahead";break}a(h);var f=this.disjunction();return this.consumeChar(")"),{type:h,value:f,loc:this.loc(l)}}d()},t.prototype.quantifier=function(l){var h,f=this.idx;switch(this.popChar()){case"*":h={atLeast:0,atMost:1/0};break;case"+":h={atLeast:1,atMost:1/0};break;case"?":h={atLeast:0,atMost:1};break;case"{":var C=this.integerIncludingZero();switch(this.popChar()){case"}":h={atLeast:C,atMost:C};break;case",":var b;this.isDigit()?(b=this.integerIncludingZero(),h={atLeast:C,atMost:b}):h={atLeast:C,atMost:1/0},this.consumeChar("}");break}if(l===!0&&h===void 0)return;a(h);break}if(!(l===!0&&h===void 0))return a(h),this.peekChar(0)==="?"?(this.consumeChar("?"),h.greedy=!1):h.greedy=!0,h.type="Quantifier",h.loc=this.loc(f),h},t.prototype.atom=function(){var l,h=this.idx;switch(this.peekChar()){case".":l=this.dotAll();break;case"\\":l=this.atomEscape();break;case"[":l=this.characterClass();break;case"(":l=this.group();break}return l===void 0&&this.isPatternCharacter()&&(l=this.patternCharacter()),a(l),l.loc=this.loc(h),this.isQuantifier()&&(l.quantifier=this.quantifier()),l},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[s(`
|
|
2
2
|
`),s("\r"),s("\u2028"),s("\u2029")]}},t.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},t.prototype.decimalEscapeAtom=function(){var l=this.positiveInteger();return{type:"GroupBackReference",value:l}},t.prototype.characterClassEscape=function(){var l,h=!1;switch(this.popChar()){case"d":l=m;break;case"D":l=m,h=!0;break;case"s":l=I;break;case"S":l=I,h=!0;break;case"w":l=p;break;case"W":l=p,h=!0;break}return a(l),{type:"Set",value:l,complement:h}},t.prototype.controlEscapeAtom=function(){var l;switch(this.popChar()){case"f":l=s("\f");break;case"n":l=s(`
|
|
3
3
|
`);break;case"r":l=s("\r");break;case"t":l=s(" ");break;case"v":l=s("\v");break}return a(l),{type:"Character",value:l}},t.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var l=this.popChar();if(/[a-zA-Z]/.test(l)===!1)throw Error("Invalid ");var h=l.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:h}},t.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:s("\0")}},t.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},t.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},t.prototype.identityEscapeAtom=function(){var l=this.popChar();return{type:"Character",value:s(l)}},t.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
|
|
4
4
|
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var l=this.popChar();return{type:"Character",value:s(l)}}},t.prototype.characterClass=function(){var l=[],h=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),h=!0);this.isClassAtom();){var f=this.classAtom(),C=f.type==="Character";if(C&&this.isRangeDash()){this.consumeChar("-");var b=this.classAtom(),y=b.type==="Character";if(y){if(b.value<f.value)throw Error("Range out of order in character class");l.push({from:f.value,to:b.value})}else c(f.value,l),l.push(s("-")),c(b.value,l)}else c(f.value,l)}return this.consumeChar("]"),{type:"Set",complement:h,value:l}},t.prototype.classAtom=function(){switch(this.peekChar()){case"]":case`
|
|
@@ -289,5 +289,5 @@ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return I}
|
|
|
289
289
|
<button class="btn left">L</button>
|
|
290
290
|
<button class="btn right">R</button>
|
|
291
291
|
</div>
|
|
292
|
-
`,this.canvas=this.shadowRoot.querySelector("canvas-a3"),this.scene=this.canvas.scene,this.camera=this.canvas.camera,this.controller=this.canvas.controller,this._maxDistance=40,this._leftActive=!1,this._leftCenter={x:0,y:0},this.leftJoystick={x:0,y:0},this._rightActive=!1,this._rightCenter={x:0,y:0},this.rightJoystick={x:0,y:0},this.leftButton=!1,this.rightButton=!1,this.keys=new Set;const t=this.shadowRoot.querySelector(".joystick.left .stick");if(!t)return;t.addEventListener("pointerdown",s=>{this._leftActive=!0;const c=t.getBoundingClientRect();this._leftCenter.x=c.left+c.width/2,this._leftCenter.y=c.top+c.height/2,t.setPointerCapture(s.pointerId)}),t.addEventListener("pointermove",s=>{if(!this._leftActive)return;const c=s.clientX-this._leftCenter.x,A=s.clientY-this._leftCenter.y,a=Math.sqrt(c*c+A*A);let d=c,u=A;if(a>40){const m=Math.atan2(A,c);d=Math.cos(m)*this._maxDistance,u=Math.sin(m)*this._maxDistance}t.style.transform=`translate(calc(-50% + ${d}px), calc(-50% + ${u}px))`,this.leftJoystick.x=d/this._maxDistance,this.leftJoystick.y=-(u/this._maxDistance)}),t.addEventListener("pointerup",()=>{this._leftActive=!1,t.style.transform="translate(-50%, -50%)",this.leftJoystick.x=0,this.leftJoystick.y=0});const n=this.shadowRoot.querySelector(".joystick.right .stick");if(!n)return;n.addEventListener("pointerdown",s=>{this._rightActive=!0;const c=n.getBoundingClientRect();this._rightCenter.x=c.left+c.width/2,this._rightCenter.y=c.top+c.height/2,n.setPointerCapture(s.pointerId)}),n.addEventListener("pointermove",s=>{if(!this._rightActive)return;const c=s.clientX-this._rightCenter.x,A=s.clientY-this._rightCenter.y,a=Math.sqrt(c*c+A*A);let d=c,u=A;if(a>40){const m=Math.atan2(A,c);d=Math.cos(m)*this._maxDistance,u=Math.sin(m)*this._maxDistance}n.style.transform=`translate(calc(-50% + ${d}px), calc(-50% + ${u}px))`,this.rightJoystick.x=d/this._maxDistance,this.rightJoystick.y=-(u/this._maxDistance)}),n.addEventListener("pointerup",()=>{this._rightActive=!1,n.style.transform="translate(-50%, -50%)",this.rightJoystick.x=0,this.rightJoystick.y=0});const r=this.shadowRoot.querySelector(".btn.left");if(!r)return;r.addEventListener("pointerdown",()=>{this.leftButton=!0}),r.addEventListener("pointerup",()=>{this.leftButton=!1});const o=this.shadowRoot.querySelector(".btn.right");o&&(o.addEventListener("pointerdown",()=>{this.rightButton=!0}),o.addEventListener("pointerup",()=>{this.rightButton=!1}),window.addEventListener("keydown",this.keyDownListener),window.addEventListener("keyup",this.keyUpListener),this.options.touchDevice||(this.shadowRoot.querySelectorAll(".joystick").forEach(s=>{s.style.display="none"}),this.shadowRoot.querySelectorAll(".btn").forEach(s=>{s.style.display="none"})))}keyDownListener=e=>{this.keys.add(e.code),this.updateUIFromKeyInfo()};keyUpListener=e=>{this.keys.delete(e.code),this.updateUIFromKeyInfo()};connectedCallback(){this._ro=new ResizeObserver(e=>{const t=e[0],n=t.contentRect.width,r=t.contentRect.height;if(!(n===0||r===0))if(n>r){const o=this.shadowRoot.querySelector(".btn.left");o.style.bottom="50px",o.style.left="200px";const s=this.shadowRoot.querySelector(".btn.right");s.style.bottom="50px",s.style.right="200px"}else{const o=this.shadowRoot.querySelector(".btn.left");o.style.bottom="200px",o.style.left="50px";const s=this.shadowRoot.querySelector(".btn.right");s.style.bottom="200px",s.style.right="50px"}}),this._ro.observe(this)}disconnectedCallback(){this._ro?.disconnect(),window.removeEventListener("keydown",this.keyDownListener),window.removeEventListener("keyup",this.keyUpListener)}updateUIFromKeyInfo(){const e={x:0,y:0},t={x:0,y:0};this.keys.has("KeyW")&&(e.y+=1),this.keys.has("KeyA")&&(e.x-=1),this.keys.has("KeyS")&&(e.y-=1),this.keys.has("KeyD")&&(e.x+=1),this.keys.has("ArrowUp")&&(t.y+=1),this.keys.has("ArrowLeft")&&(t.x-=1),this.keys.has("ArrowDown")&&(t.y-=1),this.keys.has("ArrowRight")&&(t.x+=1);const n=Math.sqrt(e.x*e.x+e.y*e.y);n>0&&(e.x/=n,e.y/=n),this.leftJoystick=e;const r=Math.sqrt(t.x*t.x+t.y*t.y);r>0&&(t.x/=r,t.y/=r),this.rightJoystick=t,this.keys.has("Space")?this.leftButton=!0:this.leftButton=!1,this.keys.has("Enter")?this.rightButton=!0:this.rightButton=!1}replaceScene(e){return this.canvas.replaceScene(e)}setController(e){this.canvas.setController(e)}worldToScreen(e){return this.canvas.worldToScreen(e)}screenToWorld(e,t,n){return this.canvas.screenToWorld(e,t,n)}cameraToScreen(e){return this.canvas.cameraToScreen(e)}screenToCamera(e,t,n){return this.canvas.screenToCamera(e,t,n)}waitForRender(){return this.canvas.waitForRender()}alert(e,t){return this.canvas.alert(e,t)}prompt(e,t){return this.canvas.prompt(e,t)}}customElements.define("game-canvas-a3",pr);const gr={mass:10,defaultLocation:{x:0,y:1,z:0},defaultQuat:{x:0,y:0,z:0,w:1},chassisWidth:2,chassisHeight:1,chassisLength:4,chassisOffset:{x:0,y:-.5,z:0},chassisFriction:.1,wheelFrontYPosition:0,wheelFrontZPosition:1.5,wheelFrontAxleLength:2,wheelRearYPosition:0,wheelRearZPosition:-1.5,wheelRearAxleLength:2,wheelFrontRadius:.3,wheelRearRadius:.3,wheelFrontWidth:.4,wheelRearWidth:.4,wheelFrontSuspensionRestLength:.8,wheelRearSuspensionRestLength:.8,wheelFrontDirection:{x:0,y:-1,z:0},wheelRearDirection:{x:0,y:-1,z:0},wheelFrontAxle:{x:-1,y:0,z:0},wheelRearAxle:{x:-1,y:0,z:0},wheelFrontSuspensionStiffness:24,wheelRearSuspensionStiffness:24,wheelFrontSuspensionCompression:4,wheelRearSuspensionCompression:4,wheelFrontSuspensionRelaxation:3,wheelRearSuspensionRelaxation:3,wheelFrontWheelFrictionSlip:100,wheelRearWheelFrictionSlip:100,wheelFrontMaxSuspensionTravel:.25,wheelRearMaxSuspensionTravel:.25,aerodynamicDrag:0};class Ys{opt;trans;motion;constructor(e){this.opt={...gr,...e},this.trans=new mr(this),this.motion=new Er(this)}steer(e){this.trans.controller&&(this.trans.controller.setWheelSteering(0,e),this.trans.controller.setWheelSteering(1,e))}accelerate(e){this.trans.controller&&(this.trans.controller.setWheelEngineForce(0,e),this.trans.controller.setWheelEngineForce(1,e),this.trans.controller.setWheelEngineForce(2,e),this.trans.controller.setWheelEngineForce(3,e))}brake(e){this.trans.controller&&(this.trans.controller.setWheelBrake(0,e),this.trans.controller.setWheelBrake(1,e),this.trans.controller.setWheelBrake(2,e),this.trans.controller.setWheelBrake(3,e))}reset(e,t){this.trans.chassisBody&&(e?this.trans.chassisBody.setTranslation({x:e.x,y:e.y,z:e.z},!0):this.trans.chassisBody.setTranslation(this.opt.defaultLocation,!0),t?this.trans.chassisBody.setRotation({x:t.x,y:t.y,z:t.z,w:t.w},!0):this.trans.chassisBody.setRotation(this.opt.defaultQuat,!0),this.trans.chassisBody.setLinvel({x:0,y:0,z:0},!0),this.trans.chassisBody.setAngvel({x:0,y:0,z:0},!0))}}class mr{cc;transform;objectA3;controller;chassisBodyDesc;chassisBody;chassisColliderDesc;chassisCollider;constructor(e){this.cc=e,this.transform=new ze}init(e,t){this.transform.set(e),this.objectA3=t,this.chassisBodyDesc=new je.RigidBodyDesc(je.RigidBodyType.Dynamic),this.chassisColliderDesc=je.ColliderDesc.cuboid(this.cc.opt.chassisWidth/2,this.cc.opt.chassisHeight/2,this.cc.opt.chassisLength/2),this.chassisColliderDesc.setMass(this.cc.opt.mass),this.chassisColliderDesc.setFriction(this.cc.opt.chassisFriction)}addOneselfToPhysics(e){if(this.chassisBodyDesc&&(this.chassisBody=e.world.createRigidBody(this.chassisBodyDesc),this.chassisBody.setTranslation(this.cc.opt.defaultLocation,!0),this.chassisBody.setRotation(this.cc.opt.defaultQuat,!0)),this.chassisColliderDesc&&(this.chassisCollider=e.world.createCollider(this.chassisColliderDesc,this.chassisBody)),this.chassisCollider&&this.objectA3&&it.set(this.chassisCollider.handle,this.objectA3),this.chassisBody&&(this.controller=e.world.createVehicleController(this.chassisBody)),this.controller){const t={x:0,y:0,z:0};t.x=-this.cc.opt.wheelFrontAxleLength/2,t.y=this.cc.opt.wheelFrontYPosition,t.z=this.cc.opt.wheelFrontZPosition,this.controller.addWheel(t,this.cc.opt.wheelFrontDirection,this.cc.opt.wheelFrontAxle,this.cc.opt.wheelFrontSuspensionRestLength,this.cc.opt.wheelFrontRadius),this.controller.setWheelSuspensionStiffness(0,this.cc.opt.wheelFrontSuspensionStiffness),this.controller.setWheelSuspensionCompression(0,this.cc.opt.wheelFrontSuspensionCompression),this.controller.setWheelSuspensionRelaxation(0,this.cc.opt.wheelFrontSuspensionRelaxation),this.controller.setWheelFrictionSlip(0,this.cc.opt.wheelFrontWheelFrictionSlip),this.controller.setWheelMaxSuspensionTravel(0,this.cc.opt.wheelFrontMaxSuspensionTravel),t.x=this.cc.opt.wheelFrontAxleLength/2,t.y=this.cc.opt.wheelFrontYPosition,t.z=this.cc.opt.wheelFrontZPosition,this.controller.addWheel(t,this.cc.opt.wheelFrontDirection,this.cc.opt.wheelFrontAxle,this.cc.opt.wheelFrontSuspensionRestLength,this.cc.opt.wheelFrontRadius),this.controller.setWheelSuspensionStiffness(1,this.cc.opt.wheelFrontSuspensionStiffness),this.controller.setWheelSuspensionCompression(1,this.cc.opt.wheelFrontSuspensionCompression),this.controller.setWheelSuspensionRelaxation(1,this.cc.opt.wheelFrontSuspensionRelaxation),this.controller.setWheelFrictionSlip(1,this.cc.opt.wheelFrontWheelFrictionSlip),this.controller.setWheelMaxSuspensionTravel(1,this.cc.opt.wheelFrontMaxSuspensionTravel),t.x=-this.cc.opt.wheelRearAxleLength/2,t.y=this.cc.opt.wheelRearYPosition,t.z=this.cc.opt.wheelRearZPosition,this.controller.addWheel(t,this.cc.opt.wheelRearDirection,this.cc.opt.wheelRearAxle,this.cc.opt.wheelRearSuspensionRestLength,this.cc.opt.wheelRearRadius),this.controller.setWheelSuspensionStiffness(2,this.cc.opt.wheelRearSuspensionStiffness),this.controller.setWheelSuspensionCompression(2,this.cc.opt.wheelRearSuspensionCompression),this.controller.setWheelSuspensionRelaxation(2,this.cc.opt.wheelRearSuspensionRelaxation),this.controller.setWheelFrictionSlip(2,this.cc.opt.wheelRearWheelFrictionSlip),this.controller.setWheelMaxSuspensionTravel(2,this.cc.opt.wheelRearMaxSuspensionTravel),t.x=this.cc.opt.wheelRearAxleLength/2,t.y=this.cc.opt.wheelRearYPosition,t.z=this.cc.opt.wheelRearZPosition,this.controller.addWheel(t,this.cc.opt.wheelRearDirection,this.cc.opt.wheelRearAxle,this.cc.opt.wheelRearSuspensionRestLength,this.cc.opt.wheelRearRadius),this.controller.setWheelSuspensionStiffness(3,this.cc.opt.wheelRearSuspensionStiffness),this.controller.setWheelSuspensionCompression(3,this.cc.opt.wheelRearSuspensionCompression),this.controller.setWheelSuspensionRelaxation(3,this.cc.opt.wheelRearSuspensionRelaxation),this.controller.setWheelFrictionSlip(3,this.cc.opt.wheelRearWheelFrictionSlip),this.controller.setWheelMaxSuspensionTravel(3,this.cc.opt.wheelRearMaxSuspensionTravel)}}removeOneselfFromPhysics(e){this.chassisBody&&e.world.removeRigidBody(this.chassisBody),this.chassisCollider&&(e.world.removeCollider(this.chassisCollider,!1),it.delete(this.chassisCollider.handle))}setPosition(e){}setPositionNow(e){}setQuat(e){}setQuatNow(e){}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||(e=new Ae),this.chassisBody?e.set(this.chassisBody.linvel()):this.chassisBodyDesc&&e.set(this.chassisBodyDesc.linvel),e}setAngularVelocity(e){}getAngularVelocity(e){return e||(e=new Ae),this.chassisBody?e.set(this.chassisBody.angvel()):this.chassisBodyDesc&&e.set(this.chassisBodyDesc.angvel),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}isGrounded(){if(!this.controller)return!0;let e=!1;return e||=this.controller.wheelIsInContact(0),e||=this.controller.wheelIsInContact(1),e||=this.controller.wheelIsInContact(2),e||=this.controller.wheelIsInContact(3),e}vv=new Ae;update(e){if(this.cc.opt.aerodynamicDrag>0&&this.chassisBody){const t=new Ae(this.chassisBody.linvel());Math.abs(t.y)>3&&t.set(t.x,3*t.y/Math.abs(t.y),t.z),this.vv.lerp(this.vv,t,.9);const n=this.vv.length();n!==0&&(t.set(this.vv),t.normalize(),t.scale(-n*n*this.cc.opt.aerodynamicDrag),this.chassisBody.resetForces(!0),this.chassisBody.addForce({x:t.x,y:t.y,z:t.z},!0))}this.controller?.updateVehicle(e),this.chassisBody&&this.transform.loc.set(this.chassisBody.translation()),this.chassisBody&&this.transform.quat.set(this.chassisBody.rotation())}}class Er{cm;name;playCount;time;finishListener;constructor(e){this.cm=e,this.name="default",this.playCount=0,this.time=0}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setPause(e){}setTime(e){}setFinishListener(e){this.finishListener=e}update(e){if(!this.cm.trans.chassisBody)return{};if(!this.cm.trans.controller)return{};const t=new Ae(this.cm.trans.chassisBody.translation()),n=new Me(this.cm.trans.chassisBody.rotation()),r=new Me(-n.x,-n.y,-n.z,n.w),o=new Ae(this.cm.trans.chassisBody.translation());o.add(this.cm.opt.chassisOffset),o.sub(t);const s=new Me(this.cm.trans.chassisBody.rotation());s.mul(r);const c=new Me,A=new Ae,a=new Me;{const l=this.cm.opt.wheelFrontAxle,h=this.cm.trans.controller.wheelSuspensionLength(0)||0,f=this.cm.trans.controller.wheelSteering(0)||0,C=this.cm.trans.controller.wheelRotation(0)||0;A.set(-this.cm.opt.wheelFrontAxleLength/2,this.cm.opt.wheelFrontYPosition,this.cm.opt.wheelFrontZPosition),A.sub(0,h,0),a.set(0,Math.sin(f/2),0,Math.cos(f/2)),c.set(l.x*Math.sin(C/2),l.y*Math.sin(C/2),l.z*Math.sin(C/2),Math.cos(C/2)),a.mul(c)}const d=new Ae,u=new Me;{const l=this.cm.opt.wheelFrontAxle,h=this.cm.trans.controller.wheelSuspensionLength(1)||0,f=this.cm.trans.controller.wheelSteering(1)||0,C=this.cm.trans.controller.wheelRotation(1)||0;d.set(this.cm.opt.wheelFrontAxleLength/2,this.cm.opt.wheelFrontYPosition,this.cm.opt.wheelFrontZPosition),d.sub(0,h,0),u.set(0,Math.sin(f/2),0,Math.cos(f/2)),c.set(l.x*Math.sin(C/2),l.y*Math.sin(C/2),l.z*Math.sin(C/2),Math.cos(C/2)),u.mul(c)}const m=new Ae,p=new Me;{const l=this.cm.opt.wheelRearAxle,h=this.cm.trans.controller.wheelSuspensionLength(2)||0,f=this.cm.trans.controller.wheelSteering(2)||0,C=this.cm.trans.controller.wheelRotation(2)||0;m.set(-this.cm.opt.wheelRearAxleLength/2,this.cm.opt.wheelRearYPosition,this.cm.opt.wheelRearZPosition),m.sub(0,h,0),p.set(0,Math.sin(f/2),0,Math.cos(f/2)),c.set(l.x*Math.sin(C/2),l.y*Math.sin(C/2),l.z*Math.sin(C/2),Math.cos(C/2)),p.mul(c)}const I=new Ae,g=new Me;{const l=this.cm.opt.wheelRearAxle,h=this.cm.trans.controller.wheelSuspensionLength(3)||0,f=this.cm.trans.controller.wheelSteering(3)||0,C=this.cm.trans.controller.wheelRotation(3)||0;I.set(this.cm.opt.wheelRearAxleLength/2,this.cm.opt.wheelRearYPosition,this.cm.opt.wheelRearZPosition),I.sub(0,h,0),g.set(0,Math.sin(f/2),0,Math.cos(f/2)),c.set(l.x*Math.sin(C/2),l.y*Math.sin(C/2),l.z*Math.sin(C/2),Math.cos(C/2)),g.mul(c)}return{chassis:{loc:o,quat:s},frontRight:{loc:d,quat:u},frontLeft:{loc:A,quat:a},rearRight:{loc:I,quat:g},rearLeft:{loc:m,quat:p}}}}exports.Acerola3D=fi;exports.Action=mn;exports.ActionObject=bt;exports.AvatarPositionController=Qo;exports.AvatarVelocityController=So;exports.BaseController=Ht;exports.BaseView=Bn;exports.BillboardTransformer=Yn;exports.Box=qs;exports.Camera=mi;exports.Canvas=lr;exports.CarControl=Ys;exports.CarMotion=Er;exports.CarTransformer=mr;exports.ClipMotion=yn;exports.DefaultTransformer=Rt;exports.DynamicCharacterTransformer=oi;exports.FollowTransformer=Zn;exports.GLTF=Ss;exports.GameCanvas=pr;exports.Html3D=Ws;exports.ImagePlane=Ks;exports.KinematicCharacterTransformer=ii;exports.ObjectA3=Oe;exports.OrbitController=Ei;exports.Quat=Me;exports.RapierPhysicsEngine=vt;exports.RapierPhysicsWorld=gn;exports.SampleObject=Fs;exports.Scene=gi;exports.SmoothBillboardTransformer=Jn;exports.SmoothTransformer=fn;exports.Sound=at;exports.Sphere=zs;exports.StandardLights=Vs;exports.StaticTransformer=Wn;exports.Text3D=js;exports.ThreeCamera=Qt;exports.ThreeObject=Hs;exports.Transform=ze;exports.Vec3=Ae;exports.Window=hr;exports.asyncSleep=jr;exports.collisionMap=it;exports.deepMerge=Ot;exports.defaultCanvasOptions=cr;exports.defaultCarControlOptions=gr;exports.defaultDynamicCharacterTransformerOptions=ri;exports.defaultFollowTransformerOptions=Xn;exports.defaultGameCanvasOptions=fr;exports.defaultKinematicCharacterTransformerOptions=ni;exports.defaultSampleObjectOptions=dn;exports.defaultWindowOptions=ur;exports.eulerToQuaternion=ht;exports.getLookAtQuaternion=At;exports.initFont=Us;exports.initPhysics=Ur;exports.initSound=Ro;exports.recreateGLTFLoader=wn;
|
|
292
|
+
`,this.canvas=this.shadowRoot.querySelector("canvas-a3"),this.scene=this.canvas.scene,this.camera=this.canvas.camera,this.controller=this.canvas.controller,this._maxDistance=40,this._leftActive=!1,this._leftCenter={x:0,y:0},this.leftJoystick={x:0,y:0},this._rightActive=!1,this._rightCenter={x:0,y:0},this.rightJoystick={x:0,y:0},this.leftButton=!1,this.rightButton=!1,this.keys=new Set;const t=this.shadowRoot.querySelector(".joystick.left .stick");if(!t)return;t.addEventListener("pointerdown",s=>{this._leftActive=!0;const c=t.getBoundingClientRect();this._leftCenter.x=c.left+c.width/2,this._leftCenter.y=c.top+c.height/2,t.setPointerCapture(s.pointerId)}),t.addEventListener("pointermove",s=>{if(!this._leftActive)return;const c=s.clientX-this._leftCenter.x,A=s.clientY-this._leftCenter.y,a=Math.sqrt(c*c+A*A);let d=c,u=A;if(a>40){const m=Math.atan2(A,c);d=Math.cos(m)*this._maxDistance,u=Math.sin(m)*this._maxDistance}t.style.transform=`translate(calc(-50% + ${d}px), calc(-50% + ${u}px))`,this.leftJoystick.x=d/this._maxDistance,this.leftJoystick.y=-(u/this._maxDistance)}),t.addEventListener("pointerup",()=>{this._leftActive=!1,t.style.transform="translate(-50%, -50%)",this.leftJoystick.x=0,this.leftJoystick.y=0});const n=this.shadowRoot.querySelector(".joystick.right .stick");if(!n)return;n.addEventListener("pointerdown",s=>{this._rightActive=!0;const c=n.getBoundingClientRect();this._rightCenter.x=c.left+c.width/2,this._rightCenter.y=c.top+c.height/2,n.setPointerCapture(s.pointerId)}),n.addEventListener("pointermove",s=>{if(!this._rightActive)return;const c=s.clientX-this._rightCenter.x,A=s.clientY-this._rightCenter.y,a=Math.sqrt(c*c+A*A);let d=c,u=A;if(a>40){const m=Math.atan2(A,c);d=Math.cos(m)*this._maxDistance,u=Math.sin(m)*this._maxDistance}n.style.transform=`translate(calc(-50% + ${d}px), calc(-50% + ${u}px))`,this.rightJoystick.x=d/this._maxDistance,this.rightJoystick.y=-(u/this._maxDistance)}),n.addEventListener("pointerup",()=>{this._rightActive=!1,n.style.transform="translate(-50%, -50%)",this.rightJoystick.x=0,this.rightJoystick.y=0});const r=this.shadowRoot.querySelector(".btn.left");if(!r)return;r.addEventListener("pointerdown",()=>{this.leftButton=!0}),r.addEventListener("pointerup",()=>{this.leftButton=!1});const o=this.shadowRoot.querySelector(".btn.right");o&&(o.addEventListener("pointerdown",()=>{this.rightButton=!0}),o.addEventListener("pointerup",()=>{this.rightButton=!1}),window.addEventListener("keydown",this.keyDownListener),window.addEventListener("keyup",this.keyUpListener),this.options.touchDevice||(this.shadowRoot.querySelectorAll(".joystick").forEach(s=>{s.style.display="none"}),this.shadowRoot.querySelectorAll(".btn").forEach(s=>{s.style.display="none"})))}keyDownListener=e=>{this.keys.add(e.code),this.updateUIFromKeyInfo()};keyUpListener=e=>{this.keys.delete(e.code),this.updateUIFromKeyInfo()};connectedCallback(){this._ro=new ResizeObserver(e=>{const t=e[0],n=t.contentRect.width,r=t.contentRect.height;if(!(n===0||r===0))if(n>r){const o=this.shadowRoot.querySelector(".btn.left");o.style.bottom="50px",o.style.left="200px";const s=this.shadowRoot.querySelector(".btn.right");s.style.bottom="50px",s.style.right="200px"}else{const o=this.shadowRoot.querySelector(".btn.left");o.style.bottom="200px",o.style.left="50px";const s=this.shadowRoot.querySelector(".btn.right");s.style.bottom="200px",s.style.right="50px"}}),this._ro.observe(this)}disconnectedCallback(){this._ro?.disconnect(),window.removeEventListener("keydown",this.keyDownListener),window.removeEventListener("keyup",this.keyUpListener)}updateUIFromKeyInfo(){const e={x:0,y:0},t={x:0,y:0};this.keys.has("KeyW")&&(e.y+=1),this.keys.has("KeyA")&&(e.x-=1),this.keys.has("KeyS")&&(e.y-=1),this.keys.has("KeyD")&&(e.x+=1),this.keys.has("ArrowUp")&&(t.y+=1),this.keys.has("ArrowLeft")&&(t.x-=1),this.keys.has("ArrowDown")&&(t.y-=1),this.keys.has("ArrowRight")&&(t.x+=1);const n=Math.sqrt(e.x*e.x+e.y*e.y);n>0&&(e.x/=n,e.y/=n),this.leftJoystick=e;const r=Math.sqrt(t.x*t.x+t.y*t.y);r>0&&(t.x/=r,t.y/=r),this.rightJoystick=t,this.keys.has("Space")?this.leftButton=!0:this.leftButton=!1,this.keys.has("Enter")?this.rightButton=!0:this.rightButton=!1}replaceScene(e){return this.canvas.replaceScene(e)}setController(e){this.canvas.setController(e)}worldToScreen(e){return this.canvas.worldToScreen(e)}screenToWorld(e,t,n){return this.canvas.screenToWorld(e,t,n)}cameraToScreen(e){return this.canvas.cameraToScreen(e)}screenToCamera(e,t,n){return this.canvas.screenToCamera(e,t,n)}waitForRender(){return this.canvas.waitForRender()}alert(e,t){return this.canvas.alert(e,t)}prompt(e,t){return this.canvas.prompt(e,t)}}customElements.define("game-canvas-a3",pr);const gr={mass:10,defaultLocation:{x:0,y:1,z:0},defaultQuat:{x:0,y:0,z:0,w:1},chassisWidth:2,chassisHeight:1,chassisLength:4,chassisOffset:{x:0,y:-.5,z:0},chassisFriction:.1,wheelFrontYPosition:0,wheelFrontZPosition:1.5,wheelFrontAxleLength:2,wheelRearYPosition:0,wheelRearZPosition:-1.5,wheelRearAxleLength:2,wheelFrontRadius:.3,wheelRearRadius:.3,wheelFrontWidth:.4,wheelRearWidth:.4,wheelFrontSuspensionRestLength:.8,wheelRearSuspensionRestLength:.8,wheelFrontDirection:{x:0,y:-1,z:0},wheelRearDirection:{x:0,y:-1,z:0},wheelFrontAxle:{x:-1,y:0,z:0},wheelRearAxle:{x:-1,y:0,z:0},wheelFrontSuspensionStiffness:24,wheelRearSuspensionStiffness:24,wheelFrontSuspensionCompression:4,wheelRearSuspensionCompression:4,wheelFrontSuspensionRelaxation:3,wheelRearSuspensionRelaxation:3,wheelFrontWheelFrictionSlip:100,wheelRearWheelFrictionSlip:100,wheelFrontMaxSuspensionTravel:.25,wheelRearMaxSuspensionTravel:.25,aerodynamicDrag:0};class Ys{opt;trans;motion;constructor(e){this.opt={...gr,...e},this.trans=new mr(this),this.motion=new Er(this)}steer(e){this.trans.controller&&(this.trans.controller.setWheelSteering(0,e),this.trans.controller.setWheelSteering(1,e))}accelerate(e){this.trans.controller&&(this.trans.controller.setWheelEngineForce(0,e),this.trans.controller.setWheelEngineForce(1,e),this.trans.controller.setWheelEngineForce(2,e),this.trans.controller.setWheelEngineForce(3,e))}brake(e){this.trans.controller&&(this.trans.controller.setWheelBrake(0,e),this.trans.controller.setWheelBrake(1,e),this.trans.controller.setWheelBrake(2,e),this.trans.controller.setWheelBrake(3,e))}reset(e,t){this.trans.chassisBody&&(e?this.trans.chassisBody.setTranslation({x:e.x,y:e.y,z:e.z},!0):this.trans.chassisBody.setTranslation(this.opt.defaultLocation,!0),t?this.trans.chassisBody.setRotation({x:t.x,y:t.y,z:t.z,w:t.w},!0):this.trans.chassisBody.setRotation(this.opt.defaultQuat,!0),this.trans.chassisBody.setLinvel({x:0,y:0,z:0},!0),this.trans.chassisBody.setAngvel({x:0,y:0,z:0},!0))}}class mr{cc;transform;objectA3;controller;chassisBodyDesc;chassisBody;chassisColliderDesc;chassisCollider;constructor(e){this.cc=e,this.transform=new ze}init(e,t){this.transform.set(e),this.objectA3=t,this.chassisBodyDesc=new je.RigidBodyDesc(je.RigidBodyType.Dynamic),this.chassisColliderDesc=je.ColliderDesc.cuboid(this.cc.opt.chassisWidth/2,this.cc.opt.chassisHeight/2,this.cc.opt.chassisLength/2),this.chassisColliderDesc.setMass(this.cc.opt.mass),this.chassisColliderDesc.setFriction(this.cc.opt.chassisFriction)}addOneselfToPhysics(e){if(this.chassisBodyDesc&&(this.chassisBody=e.world.createRigidBody(this.chassisBodyDesc),this.chassisBody.setTranslation(this.cc.opt.defaultLocation,!0),this.chassisBody.setRotation(this.cc.opt.defaultQuat,!0)),this.chassisColliderDesc&&(this.chassisCollider=e.world.createCollider(this.chassisColliderDesc,this.chassisBody)),this.chassisCollider&&this.objectA3&&it.set(this.chassisCollider.handle,this.objectA3),this.chassisBody&&(this.controller=e.world.createVehicleController(this.chassisBody)),this.controller){const t={x:0,y:0,z:0};t.x=-this.cc.opt.wheelFrontAxleLength/2,t.y=this.cc.opt.wheelFrontYPosition,t.z=this.cc.opt.wheelFrontZPosition,this.controller.addWheel(t,this.cc.opt.wheelFrontDirection,this.cc.opt.wheelFrontAxle,this.cc.opt.wheelFrontSuspensionRestLength,this.cc.opt.wheelFrontRadius),this.controller.setWheelSuspensionStiffness(0,this.cc.opt.wheelFrontSuspensionStiffness),this.controller.setWheelSuspensionCompression(0,this.cc.opt.wheelFrontSuspensionCompression),this.controller.setWheelSuspensionRelaxation(0,this.cc.opt.wheelFrontSuspensionRelaxation),this.controller.setWheelFrictionSlip(0,this.cc.opt.wheelFrontWheelFrictionSlip),this.controller.setWheelMaxSuspensionTravel(0,this.cc.opt.wheelFrontMaxSuspensionTravel),t.x=this.cc.opt.wheelFrontAxleLength/2,t.y=this.cc.opt.wheelFrontYPosition,t.z=this.cc.opt.wheelFrontZPosition,this.controller.addWheel(t,this.cc.opt.wheelFrontDirection,this.cc.opt.wheelFrontAxle,this.cc.opt.wheelFrontSuspensionRestLength,this.cc.opt.wheelFrontRadius),this.controller.setWheelSuspensionStiffness(1,this.cc.opt.wheelFrontSuspensionStiffness),this.controller.setWheelSuspensionCompression(1,this.cc.opt.wheelFrontSuspensionCompression),this.controller.setWheelSuspensionRelaxation(1,this.cc.opt.wheelFrontSuspensionRelaxation),this.controller.setWheelFrictionSlip(1,this.cc.opt.wheelFrontWheelFrictionSlip),this.controller.setWheelMaxSuspensionTravel(1,this.cc.opt.wheelFrontMaxSuspensionTravel),t.x=-this.cc.opt.wheelRearAxleLength/2,t.y=this.cc.opt.wheelRearYPosition,t.z=this.cc.opt.wheelRearZPosition,this.controller.addWheel(t,this.cc.opt.wheelRearDirection,this.cc.opt.wheelRearAxle,this.cc.opt.wheelRearSuspensionRestLength,this.cc.opt.wheelRearRadius),this.controller.setWheelSuspensionStiffness(2,this.cc.opt.wheelRearSuspensionStiffness),this.controller.setWheelSuspensionCompression(2,this.cc.opt.wheelRearSuspensionCompression),this.controller.setWheelSuspensionRelaxation(2,this.cc.opt.wheelRearSuspensionRelaxation),this.controller.setWheelFrictionSlip(2,this.cc.opt.wheelRearWheelFrictionSlip),this.controller.setWheelMaxSuspensionTravel(2,this.cc.opt.wheelRearMaxSuspensionTravel),t.x=this.cc.opt.wheelRearAxleLength/2,t.y=this.cc.opt.wheelRearYPosition,t.z=this.cc.opt.wheelRearZPosition,this.controller.addWheel(t,this.cc.opt.wheelRearDirection,this.cc.opt.wheelRearAxle,this.cc.opt.wheelRearSuspensionRestLength,this.cc.opt.wheelRearRadius),this.controller.setWheelSuspensionStiffness(3,this.cc.opt.wheelRearSuspensionStiffness),this.controller.setWheelSuspensionCompression(3,this.cc.opt.wheelRearSuspensionCompression),this.controller.setWheelSuspensionRelaxation(3,this.cc.opt.wheelRearSuspensionRelaxation),this.controller.setWheelFrictionSlip(3,this.cc.opt.wheelRearWheelFrictionSlip),this.controller.setWheelMaxSuspensionTravel(3,this.cc.opt.wheelRearMaxSuspensionTravel)}}removeOneselfFromPhysics(e){this.chassisCollider&&(e.world.removeCollider(this.chassisCollider,!1),it.delete(this.chassisCollider.handle)),this.chassisBody&&e.world.removeRigidBody(this.chassisBody)}setPosition(e){}setPositionNow(e){}setQuat(e){}setQuatNow(e){}setScale(e){}setScaleNow(e){}setLinearVelocity(e){}getLinearVelocity(e){return e||(e=new Ae),this.chassisBody?e.set(this.chassisBody.linvel()):this.chassisBodyDesc&&e.set(this.chassisBodyDesc.linvel),e}setAngularVelocity(e){}getAngularVelocity(e){return e||(e=new Ae),this.chassisBody?e.set(this.chassisBody.angvel()):this.chassisBodyDesc&&e.set(this.chassisBodyDesc.angvel),e}resetForce(){}addForce(e){}addForceAtPoint(e,t){}resetTorque(){}addTorque(e){}applyImpulse(e){}applyImpulseAtPoint(e,t){}applyTorqueImpulse(e){}isGrounded(){if(!this.controller)return!0;let e=!1;return e||=this.controller.wheelIsInContact(0),e||=this.controller.wheelIsInContact(1),e||=this.controller.wheelIsInContact(2),e||=this.controller.wheelIsInContact(3),e}vv=new Ae;update(e){if(this.cc.opt.aerodynamicDrag>0&&this.chassisBody){const t=new Ae(this.chassisBody.linvel());Math.abs(t.y)>3&&t.set(t.x,3*t.y/Math.abs(t.y),t.z),this.vv.lerp(this.vv,t,.9);const n=this.vv.length();n!==0&&(t.set(this.vv),t.normalize(),t.scale(-n*n*this.cc.opt.aerodynamicDrag),this.chassisBody.resetForces(!0),this.chassisBody.addForce({x:t.x,y:t.y,z:t.z},!0))}this.controller?.updateVehicle(e),this.chassisBody&&this.transform.loc.set(this.chassisBody.translation()),this.chassisBody&&this.transform.quat.set(this.chassisBody.rotation())}}class Er{cm;name;playCount;time;finishListener;constructor(e){this.cm=e,this.name="default",this.playCount=0,this.time=0}addOneselfToPhysics(e){}removeOneselfFromPhysics(e){}setPause(e){}setTime(e){}setFinishListener(e){this.finishListener=e}update(e){if(!this.cm.trans.chassisBody)return{};if(!this.cm.trans.controller)return{};const t=new Ae(this.cm.trans.chassisBody.translation()),n=new Me(this.cm.trans.chassisBody.rotation()),r=new Me(-n.x,-n.y,-n.z,n.w),o=new Ae(this.cm.trans.chassisBody.translation());o.add(this.cm.opt.chassisOffset),o.sub(t);const s=new Me(this.cm.trans.chassisBody.rotation());s.mul(r);const c=new Me,A=new Ae,a=new Me;{const l=this.cm.opt.wheelFrontAxle,h=this.cm.trans.controller.wheelSuspensionLength(0)||0,f=this.cm.trans.controller.wheelSteering(0)||0,C=this.cm.trans.controller.wheelRotation(0)||0;A.set(-this.cm.opt.wheelFrontAxleLength/2,this.cm.opt.wheelFrontYPosition,this.cm.opt.wheelFrontZPosition),A.sub(0,h,0),a.set(0,Math.sin(f/2),0,Math.cos(f/2)),c.set(l.x*Math.sin(C/2),l.y*Math.sin(C/2),l.z*Math.sin(C/2),Math.cos(C/2)),a.mul(c)}const d=new Ae,u=new Me;{const l=this.cm.opt.wheelFrontAxle,h=this.cm.trans.controller.wheelSuspensionLength(1)||0,f=this.cm.trans.controller.wheelSteering(1)||0,C=this.cm.trans.controller.wheelRotation(1)||0;d.set(this.cm.opt.wheelFrontAxleLength/2,this.cm.opt.wheelFrontYPosition,this.cm.opt.wheelFrontZPosition),d.sub(0,h,0),u.set(0,Math.sin(f/2),0,Math.cos(f/2)),c.set(l.x*Math.sin(C/2),l.y*Math.sin(C/2),l.z*Math.sin(C/2),Math.cos(C/2)),u.mul(c)}const m=new Ae,p=new Me;{const l=this.cm.opt.wheelRearAxle,h=this.cm.trans.controller.wheelSuspensionLength(2)||0,f=this.cm.trans.controller.wheelSteering(2)||0,C=this.cm.trans.controller.wheelRotation(2)||0;m.set(-this.cm.opt.wheelRearAxleLength/2,this.cm.opt.wheelRearYPosition,this.cm.opt.wheelRearZPosition),m.sub(0,h,0),p.set(0,Math.sin(f/2),0,Math.cos(f/2)),c.set(l.x*Math.sin(C/2),l.y*Math.sin(C/2),l.z*Math.sin(C/2),Math.cos(C/2)),p.mul(c)}const I=new Ae,g=new Me;{const l=this.cm.opt.wheelRearAxle,h=this.cm.trans.controller.wheelSuspensionLength(3)||0,f=this.cm.trans.controller.wheelSteering(3)||0,C=this.cm.trans.controller.wheelRotation(3)||0;I.set(this.cm.opt.wheelRearAxleLength/2,this.cm.opt.wheelRearYPosition,this.cm.opt.wheelRearZPosition),I.sub(0,h,0),g.set(0,Math.sin(f/2),0,Math.cos(f/2)),c.set(l.x*Math.sin(C/2),l.y*Math.sin(C/2),l.z*Math.sin(C/2),Math.cos(C/2)),g.mul(c)}return{chassis:{loc:o,quat:s},frontRight:{loc:d,quat:u},frontLeft:{loc:A,quat:a},rearRight:{loc:I,quat:g},rearLeft:{loc:m,quat:p}}}}exports.Acerola3D=fi;exports.Action=mn;exports.ActionObject=bt;exports.AvatarPositionController=Qo;exports.AvatarVelocityController=So;exports.BaseController=Ht;exports.BaseView=Bn;exports.BillboardTransformer=Yn;exports.Box=qs;exports.Camera=mi;exports.Canvas=lr;exports.CarControl=Ys;exports.CarMotion=Er;exports.CarTransformer=mr;exports.ClipMotion=yn;exports.DefaultTransformer=Rt;exports.DynamicCharacterTransformer=oi;exports.FollowTransformer=Zn;exports.GLTF=Ss;exports.GameCanvas=pr;exports.Html3D=Ws;exports.ImagePlane=Ks;exports.KinematicCharacterTransformer=ii;exports.ObjectA3=Oe;exports.OrbitController=Ei;exports.Quat=Me;exports.RapierPhysicsEngine=vt;exports.RapierPhysicsWorld=gn;exports.SampleObject=Fs;exports.Scene=gi;exports.SmoothBillboardTransformer=Jn;exports.SmoothTransformer=fn;exports.Sound=at;exports.Sphere=zs;exports.StandardLights=Vs;exports.StaticTransformer=Wn;exports.Text3D=js;exports.ThreeCamera=Qt;exports.ThreeObject=Hs;exports.Transform=ze;exports.Vec3=Ae;exports.Window=hr;exports.asyncSleep=jr;exports.collisionMap=it;exports.deepMerge=Ot;exports.defaultCanvasOptions=cr;exports.defaultCarControlOptions=gr;exports.defaultDynamicCharacterTransformerOptions=ri;exports.defaultFollowTransformerOptions=Xn;exports.defaultGameCanvasOptions=fr;exports.defaultKinematicCharacterTransformerOptions=ni;exports.defaultSampleObjectOptions=dn;exports.defaultWindowOptions=ur;exports.eulerToQuaternion=ht;exports.getLookAtQuaternion=At;exports.initFont=Us;exports.initPhysics=Ur;exports.initSound=Ro;exports.recreateGLTFLoader=wn;
|
|
293
293
|
//# sourceMappingURL=a3js.cjs.js.map
|