@needle-tools/engine 5.0.6 → 5.0.7-next.5cb6b55
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/CHANGELOG.md +4 -0
- package/SKILL.md +4 -1
- package/dist/{needle-engine.bundle-BNqZHrmH.min.js → needle-engine.bundle-BUL3r1DP.min.js} +2 -2
- package/dist/{needle-engine.bundle-BY1mZ1X_.umd.cjs → needle-engine.bundle-DxyzNZxC.umd.cjs} +3 -3
- package/dist/{needle-engine.bundle-BsFWwS-j.js → needle-engine.bundle-jEzXduRL.js} +4 -4
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
- package/package.json +2 -2
- package/plugins/common/worker.js +9 -4
- package/plugins/vite/asap.js +17 -8
- package/plugins/vite/dependencies.js +29 -10
- package/plugins/vite/license.js +19 -1
- package/plugins/vite/local-files-core.js +3 -3
- package/plugins/vite/local-files-utils.d.ts +3 -1
- package/plugins/vite/local-files-utils.js +29 -5
- package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [5.0.7] - 2026-05-06
|
|
8
|
+
- Fix: Projects deployed to sub-directories using SPA routing now load correctly (worker URLs, file aliases, and asset paths respect vite.config `base`)
|
|
9
|
+
- Fix: MeshBVH worker now loads correctly in local development
|
|
10
|
+
|
|
7
11
|
## [5.0.6] - 2026-04-29
|
|
8
12
|
- Fix: UI Text font URLs now resolve correctly when loading GLBs from external hosts (e.g. CDN or absolute URLs)
|
|
9
13
|
- Add: UI Text default static font served from Needle CDN, allowing users to provide absolute font URLs
|
package/SKILL.md
CHANGED
|
@@ -58,6 +58,9 @@ export class HelloWorld extends Behaviour {
|
|
|
58
58
|
**Code-only (no Unity/Blender):**
|
|
59
59
|
Scaffold a project with `npm create needle`, write TypeScript components, and build scenes entirely from code. Use `onStart`, `onUpdate`, and other lifecycle hooks to set up scenes, or create components extending `Behaviour`. This is a fully supported first-class workflow.
|
|
60
60
|
|
|
61
|
+
**CDN with import maps (no bundler):**
|
|
62
|
+
For quick prototypes, embedding in existing sites, or projects without a build pipeline. Use `<script type="importmap">` to map bare specifiers to CDN URLs, then write standard ES module code with `import` statements — no Vite, no npm, no `node_modules` required. **Important:** three.js must come from `@needle-tools/engine/dist/three.min.js`, not a standalone three.js CDN. See [CDN & Import Maps](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/integration.md) for full examples and rules.
|
|
63
|
+
|
|
61
64
|
**Unity or Blender as visual editors:**
|
|
62
65
|
Unity/Blender export scenes as GLB files into `assets/`, with component data serialized in glTF extensions. At runtime, the engine deserializes this into TypeScript components. A component compiler auto-generates C# stubs (Unity) or JSON (Blender) so custom TS components appear in the editor inspector. The editors are tools for visual scene setup; the runtime is pure web/TypeScript. Note: the editor controls the engine version in `package.json` — to force a version, use `"@needle-tools/engine": "npm:@needle-tools/engine@5.0.1"`.
|
|
63
66
|
|
|
@@ -417,7 +420,7 @@ Read these **only when needed** — don't load them all upfront:
|
|
|
417
420
|
- 🌐 [Networking](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/networking.md) — connection API, SyncedRoom, PlayerSync, @syncField, SyncedTransform, Voip, ScreenCapture, guid persistence
|
|
418
421
|
- 🥽 [WebXR](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/xr.md) — VR/AR sessions, XRRig, controllers, pointer events in XR, image tracking, depth sensing, camera access, mesh detection, DOM overlay, iOS AR, multiplayer avatars
|
|
419
422
|
- 🚀 [Deployment](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/deployment.md) — Needle Cloud (GitHub Actions, CLI), Vercel, Netlify, other platforms
|
|
420
|
-
- 🔗 [Framework Integration](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/integration.md) — React, Svelte, Vue, Next.js, SvelteKit patterns
|
|
423
|
+
- 🔗 [Framework Integration](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/integration.md) — React, Svelte, Vue, Next.js, SvelteKit patterns, CDN with import maps
|
|
421
424
|
- 💡 [Component Examples](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/examples.md) — practical examples: click handling, runtime loading, networking, materials, code-only scenes, input, coroutines
|
|
422
425
|
- 🐛 [Troubleshooting](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/references/troubleshooting.md) — error messages, unexpected behavior, build failures, **runtime logs at `node_modules/.needle/logs/`**, build info
|
|
423
426
|
- 🧩 [Component Template](https://raw.githubusercontent.com/needle-tools/ai/refs/heads/main/providers/claude/plugin/skills/needle-engine/templates/my-component.ts) — annotated starting point for new components
|
|
@@ -148,7 +148,7 @@ void main(){
|
|
|
148
148
|
clip: rect(0, 0, 0, 0);
|
|
149
149
|
white-space: nowrap;
|
|
150
150
|
border: 0;
|
|
151
|
-
`,this.root.setAttribute("role","region"),this.root.setAttribute("aria-label","3D Needle Engine scene"),this.liveRegion.setAttribute("aria-live","polite"),this.liveRegion.setAttribute("aria-atomic","true"),this.liveRegion.setAttribute("role","status"),this.root.appendChild(this.liveRegion),this.enabled=!0}static _managers=new WeakMap;static get(e){return Mg(e)?this._managers.get(e.context):this._managers.get(e)}_enabled;set enabled(e){e!==this._enabled&&(this._enabled=e,e?(Em._managers.set(this.context,this),(this.context.domElement.shadowRoot||this.context.domElement).prepend(this.root)):this.root.remove())}clear(){this.root.childNodes.forEach(e=>e.remove()),this.root.appendChild(this.liveRegion)}dispose(){this.root.remove(),Em._managers.delete(this.context)}root=document.createElement("div");liveRegion=document.createElement("div");treeElements=new WeakMap;updateElement(e,t){let i=this.treeElements.get(e);i||(i=document.createElement("div"),this.treeElements.set(e,i),this.root.appendChild(i),typeof t=="object"&&(t.role&&i.setAttribute("role",t.role),t.label&&i.setAttribute("aria-label",t.label),t.hidden!==void 0&&i.setAttribute("aria-hidden",String(t.hidden)),t.busy!==void 0&&i.setAttribute("aria-busy",String(t.busy))))}focus(e){const t=this.treeElements.get(e);t&&t.focus()}unfocus(e){const t=this.treeElements.get(e);t&&t.blur()}hover(e,t){const i=this.treeElements.get(e);this.liveRegion.textContent=t||i?.getAttribute("aria-label")||""}removeElement(e){this.treeElements.get(e)?.remove(),this.treeElements.delete(e)}set liveRegionMode(e){this.liveRegion.setAttribute("aria-live",e)}}let sv,rv=null;function kn(){return sv}function av(o){if(o==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}rv!==o&&(rv=o,sv=new o)}const lv=w("debugdefines");ks('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),ks('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),ks('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),ks('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),ks('globalThis["__NEEDLE_ENGINE_VERSION__"] = "5.0.
|
|
151
|
+
`,this.root.setAttribute("role","region"),this.root.setAttribute("aria-label","3D Needle Engine scene"),this.liveRegion.setAttribute("aria-live","polite"),this.liveRegion.setAttribute("aria-atomic","true"),this.liveRegion.setAttribute("role","status"),this.root.appendChild(this.liveRegion),this.enabled=!0}static _managers=new WeakMap;static get(e){return Mg(e)?this._managers.get(e.context):this._managers.get(e)}_enabled;set enabled(e){e!==this._enabled&&(this._enabled=e,e?(Em._managers.set(this.context,this),(this.context.domElement.shadowRoot||this.context.domElement).prepend(this.root)):this.root.remove())}clear(){this.root.childNodes.forEach(e=>e.remove()),this.root.appendChild(this.liveRegion)}dispose(){this.root.remove(),Em._managers.delete(this.context)}root=document.createElement("div");liveRegion=document.createElement("div");treeElements=new WeakMap;updateElement(e,t){let i=this.treeElements.get(e);i||(i=document.createElement("div"),this.treeElements.set(e,i),this.root.appendChild(i),typeof t=="object"&&(t.role&&i.setAttribute("role",t.role),t.label&&i.setAttribute("aria-label",t.label),t.hidden!==void 0&&i.setAttribute("aria-hidden",String(t.hidden)),t.busy!==void 0&&i.setAttribute("aria-busy",String(t.busy))))}focus(e){const t=this.treeElements.get(e);t&&t.focus()}unfocus(e){const t=this.treeElements.get(e);t&&t.blur()}hover(e,t){const i=this.treeElements.get(e);this.liveRegion.textContent=t||i?.getAttribute("aria-label")||""}removeElement(e){this.treeElements.get(e)?.remove(),this.treeElements.delete(e)}set liveRegionMode(e){this.liveRegion.setAttribute("aria-live",e)}}let sv,rv=null;function kn(){return sv}function av(o){if(o==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}rv!==o&&(rv=o,sv=new o)}const lv=w("debugdefines");ks('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),ks('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),ks('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),ks('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),ks('globalThis["__NEEDLE_ENGINE_VERSION__"] = "5.0.7";'),ks('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),ks('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Thu May 07 2026 14:27:02 GMT+0000 (Coordinated Universal Time)";'),ks('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const mi="5.0.7",Ha="undefined",Sc="Thu May 07 2026 14:27:02 GMT+0000 (Coordinated Universal Time)";lv&&console.log(`Engine version: ${mi} (generator: ${Ha})
|
|
152
152
|
Project built at ${Sc}`);const Os=NEEDLE_PUBLIC_KEY,Jn="needle_isActiveInHierarchy",Tr="builtin_components",Cc="needle_editor_guid";function ks(o){try{(0,eval)(o)}catch(e){lv&&console.error(e)}}const Rg={experimentalSmartHierarchyUpdate:!1};function Pc(o,e){try{e||o()}catch(t){return console.error(t),!1}return!0}const Tg=w("debugnewscripts"),Gk=w("debughierarchy"),Ae=[];function qk(){return Ae.length>0}function nu(o){if(Tg&&console.log("Register new components",o.new_scripts.length,[...o.new_scripts],o.alias?"element: "+o.alias:o.hash,o),o.new_scripts_pre_setup_callbacks.length>0){for(const e of o.new_scripts_pre_setup_callbacks)e&&e();o.new_scripts_pre_setup_callbacks.length=0}if(!(o.new_scripts.length<=0)){Ae.length=0,o.new_scripts.length>0&&Ae.push(...o.new_scripts),o.new_scripts.length=0;for(let e=0;e<Ae.length;e++)try{const t=Ae[e];if(t.isComponent!==!0){(A()||Tg)&&console.error(`Registered script is not a Needle Engine component.
|
|
153
153
|
The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
|
|
154
154
|
`,t),Ae.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.warn(`Component can not be initialized: no GameObject assigned.
|
|
@@ -1728,4 +1728,4 @@ Needle Engine: Begin loading `+i+`
|
|
|
1728
1728
|
Needle Engine: finished loading `+i+`
|
|
1729
1729
|
`,t,`Aborted? ${d.signal.aborted}`),d.signal.aborted){console.log("Loading finished but aborted...");return}if(this._loadId!==i){console.log("Load id changed during loading process");return}this._loadingProgress01=1,r&&f&&this._loadingView?.onLoadingUpdate(1,"creating scene"),this._didFullyLoad=!0,this.classList.remove("loading"),this.classList.add("loading-finished"),this.dispatchEvent(new CustomEvent("loadfinished",{detail:{context:this._context,src:n,loadedFiles:a}}))}applyAttributes(){const e=this.getOrCreateContext();if(e.renderer){const s=ow(this.toneMapping);s!==void 0&&(e.renderer.toneMapping=s);const r=this.getAttribute("tone-mapping-exposure");if(r!=null){const a=parseFloat(r);isNaN(a)||(e.renderer.toneMappingExposure=a)}}const t=this.getAttribute("background-blurriness");if(t!=null){const s=parseFloat(t);isNaN(s)||(e.scene.backgroundBlurriness=s)}const i=this.getAttribute("environment-intensity");if(i!=null){const s=parseFloat(i);isNaN(s)||(e.scene.environmentIntensity=s)}const n=this.getAttribute("background-color");if(e.renderer)if(typeof n=="string"&&n.length>0){const s=re.fromColorRepresentation(n);Re&&console.debug("<needle-engine> background-color changed, str:",n,"\u2192",s),e.renderer.setClearColor(s,s.alpha),e.scene.background=null}else this.getAttribute("background-image")&&this.setAttribute("background-image",this.getAttribute("background-image"))}onXRSessionStarted=()=>{const e=this.getOrCreateContext(),t=e.xrSessionMode;t==="immersive-ar"?this.onEnterAR(e.xrSession):t==="immersive-vr"&&this.onEnterVR(e.xrSession),e.xrSession?.addEventListener("end",()=>{this.dispatchEvent(new CustomEvent("xr-session-ended",{detail:{session:e.xrSession,context:this._context,sessionMode:t}})),t==="immersive-ar"?this.onExitAR(e.xrSession):t==="immersive-vr"&&this.onExitVR(e.xrSession)})};onReady=()=>this._loadingView?.onLoadingFinished();onError=()=>this._loadingView?.setMessage("Loading failed!");getSourceFiles(){const e=this.getAttribute("src");if(!e)return[];let t;Array.isArray(e)?t=e:e.startsWith("[")&&e.endsWith("]")?t=JSON.parse(e):e.includes(",")?t=e.split(","):t=[e];for(let i=t.length-1;i>=0;i--){const n=t[i];(n==="null"||n==="undefined"||n?.length<=0)&&t.splice(i,1)}return t}checkIfSourceHasChanged(e,t){if(e?.length!==t?.length||e==null&&t!==null||e!==null&&t==null)return!0;if(e!==null&&t!==null){for(let i=0;i<e?.length;i++)if(e[i]!==t[i])return!0}return!1}_previouslyRegisteredMap=new Map;ensureLoadStartIsRegistered(){const e=this.getAttribute("loadstart");e&&this.registerEventFromAttribute("loadstart",e)}registerEventFromAttribute(e,t){const i=this._previouslyRegisteredMap.get(e);if(i&&(this._previouslyRegisteredMap.delete(e),this.removeEventListener(e,i)),typeof t=="string"&&t.length>0)try{const n=(0,eval)(t);typeof n=="function"&&(this._previouslyRegisteredMap.set(e,n),this.addEventListener(e,s=>n?.call(globalThis,this.getOrCreateContext(),s)))}catch(n){console.error("Error registering event "+e+'="'+t+`" failed with the following error:
|
|
1730
1730
|
`,n)}}setPublicKey(){Os&&Os.length>0&&this.setAttribute("public-key",Os)}setVersion(){mi.length>0&&this.setAttribute("version",mi)}getAROverlayContainer(){return this._overlay_ar.createOverlayContainer(this)}getVROverlayContainer(){for(let e=0;e<this.children.length;e++){const t=this.children[e];if(t.classList.contains("vr"))return t}return null}onEnterAR(e){const t=this.getOrCreateContext();this.onSetupAR();const i=this.getAROverlayContainer();this._overlay_ar.onBegin(t,i,e),this.dispatchEvent(new CustomEvent("enter-ar",{detail:{session:e,context:t,htmlContainer:this._overlay_ar?.ARContainer}}))}onExitAR(e){const t=this.getOrCreateContext();this._overlay_ar.onEnd(t),this.onSetupDesktop(),this.dispatchEvent(new CustomEvent("exit-ar",{detail:{session:e,context:t,htmlContainer:this._overlay_ar?.ARContainer}}))}onEnterVR(e){const t=this.getOrCreateContext();this.onSetupVR(),this.dispatchEvent(new CustomEvent("enter-vr",{detail:{session:e,context:t}}))}onExitVR(e){const t=this.getOrCreateContext();this.onSetupDesktop(),this.dispatchEvent(new CustomEvent("exit-vr",{detail:{session:e,context:t}}))}onSetupAR(){this.classList.add(gd),this.classList.remove(fd);const e=this.getAROverlayContainer();Re&&console.warn("onSetupAR:",e),e&&(e.classList.add(gd),e.classList.remove(fd)),this.foreachHtmlElement(t=>this.setupElementsForMode(t,$S))}onSetupVR(){this.classList.remove(gd),this.classList.remove(fd),this.foreachHtmlElement(e=>this.setupElementsForMode(e,GS))}onSetupDesktop(){this.classList.remove(gd),this.classList.add(fd);const e=this.getAROverlayContainer();e&&(e.classList.remove(gd),e.classList.add(fd)),this.foreachHtmlElement(t=>this.setupElementsForMode(t,qS))}setupElementsForMode(e,t,i=null){if(!(e===this._context?.renderer?.domElement||e.id==="VRButton"||e.id==="ARButton"))if(e.classList.contains(t))e.style.visibility="visible",e.style.display==="none"&&(e.style.display="block");else for(const n of Mj)e.classList.contains(n)&&(e.style.visibility="hidden",e.style.display="none")}foreachHtmlElement(e){for(let t=0;t<this.children.length;t++){const i=this.children[t];i.style&&e(i)}}onBeforeBeginLoading(){const e=this.getAttribute("dracoDecoderPath");e&&(Re&&console.log("using custom draco decoder path",e),q1(e));const t=this.getAttribute("dracoDecoderType");t&&(Re&&console.log("using custom draco decoder type",t),X1(t));const i=this.getAttribute("ktx2DecoderPath");i&&(Re&&console.log("using custom ktx2 decoder path",i),Q1(i))}setAttribute(e,t){super.setAttribute(e,typeof t=="string"?t:String(t))}getAttribute(e){return super.getAttribute(e)}addEventListener(e,t,i){return super.addEventListener(e,t,i)}}function Rj(o){if(o.startsWith("blob:"))return"blob";const e=o.split("/");let t=e[e.length-1];const i=t.indexOf("?");i>0&&(t=t.substring(0,i));const n=t.indexOf("=");n>0&&(t=t.substring(n));const s=t.split(".").pop(),r=s?["glb","gltf","usdz","usd","fbx","obj","mtl"].indexOf(s.toLowerCase()):-1;if(s&&r>=0&&(t=t.substring(0,t.length-s.length-1)),t=decodeURIComponent(t),t.length>3){let a="",l=!1;const c=["(",")","[","]","{","}",":",";",",",".","!","?"];for(let h=0;h<t.length;h++){let d=t[h];(d==="_"||d==="-")&&(d=" "),!(d===" "&&a.length<=0||c.includes(d)||(a.length===0&&(d=d.toUpperCase()),l&&d===" "))&&(l&&(d=d.toUpperCase()),l=!1,a+=d,d===" "&&(l=!0))}return A()&&t!==a&&console.debug('Generated display name: "'+t+'" \u2192 "'+a+'"'),a.trim()}return t}function Tj(o){au(e=>{const t=o.getAttribute("loading-blur");if(t!==null&&t!=="0"&&e.domElement===o){const i=e.lodsManager.manager?.awaitLoading({frames:5,signal:AbortSignal.timeout(1e4),maxPromisesPerObject:1}).catch(r=>{});let n="20px";t.endsWith("px")&&(n=t);const s=170;if(e.scene.background===null){const r=o,a=e.renderer.domElement,l=a.style.filter,c=a.style.overflow;a.style.filter+=`blur(${n})`,r.style.overflow="hidden",i?.then(()=>{const h=a.animate([{filter:"blur(0px)"}],{duration:s,easing:"ease-in"});h.onfinish=()=>{a.style.filter=l,r.style.overflow=c}})}else{const r=document.createElement("div");e.domElement.prepend(r),r.style.cssText="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none",r.style.backdropFilter=`blur(${n})`,i?.then(()=>{const a=r.animate([{backdropFilter:"blur(0px)",opacity:0}],{duration:s,easing:"ease-in"});a.onfinish=()=>{r.remove()}})}}},{once:!0})}const Aj=Object.freeze(Object.defineProperty({__proto__:null,NeedleEngineWebComponent:fb},Symbol.toStringTag,{value:"Module"}));function Ij(){typeof window>"u"||(window.customElements.get("needle-engine")||window.customElements.define("needle-engine",fb),window.customElements.get("needle-button")||window.customElements.define("needle-button",VS),window.customElements.get("needle-logo-element")||window.customElements.define("needle-logo-element",Tm),window.customElements.get("needle-menu")||window.customElements.define("needle-menu",Od))}let XS=!1;function Lj(){XS||(XS=!0,Ij(),MA(),_x(),Av(),ZE(),Lx(),nw(),DT(),Sj(),sE(),Cj(),hj(),yj(),setTimeout(cR,1e3),KR(),QR(),gT(),sT(),hk())}const Ne=w("debugphysics"),yb=w("debugcolliderplacement"),bb=w("debugcollisions"),jj=w("showcolliders"),Sm=w("debugraycasts"),Oi=Symbol("needle component"),jt=Symbol("physics body"),QS=Symbol("rigidbody");globalThis.NEEDLE_USE_RAPIER=globalThis.NEEDLE_USE_RAPIER!==void 0?globalThis.NEEDLE_USE_RAPIER:!0,Ne&&console.log("Use Rapier",!0,globalThis.NEEDLE_USE_RAPIER),pe.registerCallback(ue.ContextCreationStart,o=>{Ne&&console.log("Register rapier physics backend"),o.context.physics.engine=new dc(o.context)});class dc{debugRenderColliders=!1;debugRenderRaycasts=!1;removeBody(e){if(Ne&&console.log("REMOVE BODY",e?.name,e[jt]),!e)return;this.validate();const t=e[jt];if(e[jt]=null,t&&this.world){const i=this.objects.findIndex(n=>n===e);if(i>=0){const n=this.bodies[i];if(this.bodies.splice(i,1),this.objects.splice(i,1),n instanceof T.RAPIER_PHYSICS.MODULE.Collider){const s=n;this.world?.removeCollider(s,!0);const r=s.parent();r&&r.numColliders()<=0&&(r[Oi]||this.world?.removeRigidBody(r))}else n instanceof T.RAPIER_PHYSICS.MODULE.RigidBody&&(n.numColliders()<=0?this.world?.removeRigidBody(n):A()&&(n.did_log_removing||setTimeout(()=>{n.numColliders()>0&&(n.did_log_removing=!0,console.warn("RapierPhysics: removing rigidbody with colliders from the physics world is not possible right now, please remove the colliders first"))},1)))}}}setColliderEnabled(e,t){const i=e[jt];return i?(i.setEnabled(t),Ne&&console.log("SET COLLIDER ENABLED",e.name,t),!0):!1}updateBody(e,t,i){if(this.validate(),!!this.enabled&&!(e.destroyed||!e.gameObject)&&!(!t&&!i))if(e.isCollider===!0)console.warn("TODO: implement updating collider position");else{const n=e,s=n[jt];s&&this.syncPhysicsBody(n.gameObject,s,t,i)}}updateProperties(e){if(this.validate(),e.isCollider){const t=e,i=t[jt];i&&(this.internalUpdateColliderProperties(t,i),t.sharedMaterial&&this.updatePhysicsMaterial(t))}else{const t=e,i=this.internal_getRigidbody(t);i&&this.internalUpdateRigidbodyProperties(t,i)}}addForce(e,t,i){this.validate();const n=this.internal_getRigidbody(e);n?n.addForce(t,i):this._isInitialized&&console.warn("Physics Body doesn't exist: can not apply force (does your object with the Rigidbody have a collider?)")}addImpulse(e,t,i){this.validate();const n=this.internal_getRigidbody(e);n?n.applyImpulse(t,i):this._isInitialized&&console.warn("Physics Body doesn't exist: can not apply impulse (does your object with the Rigidbody have a collider?)")}getLinearVelocity(e){this.validate();const t=this.internal_getRigidbody(e);return t?t.linvel():null}getAngularVelocity(e){this.validate();const t=this.internal_getRigidbody(e);return t?t.angvel():null}resetForces(e,t){this.validate(),this.internal_getRigidbody(e)?.resetForces(t)}resetTorques(e,t){this.validate(),this.internal_getRigidbody(e)?.resetTorques(t)}applyImpulse(e,t,i){this.validate();const n=this.internal_getRigidbody(e);n?n.applyImpulse(t,i):this._isInitialized&&console.warn("Rigidbody doesn't exist: can not apply impulse (does your object with the Rigidbody have a collider?)")}wakeup(e){this.validate();const t=this.internal_getRigidbody(e);t?t.wakeUp():this._isInitialized&&console.warn("Rigidbody doesn't exist: can not wake up (does your object with the Rigidbody have a collider?)")}isSleeping(e){return this.validate(),this.internal_getRigidbody(e)?.isSleeping()}setAngularVelocity(e,t,i){this.validate();const n=this.internal_getRigidbody(e);n?n.setAngvel(t,i):this._isInitialized&&console.warn("Rigidbody doesn't exist: can not set angular velocity (does your object with the Rigidbody have a collider?)")}setLinearVelocity(e,t,i){this.validate();const n=this.internal_getRigidbody(e);n?n.setLinvel(t,i):this._isInitialized&&console.warn("Rigidbody doesn't exist: can not set linear velocity (does your object with the Rigidbody have a collider?)")}context;_initializePromise;_isInitialized=!1;constructor(e){this.context=e}get isInitialized(){return this._isInitialized}async initialize(){return this._initializePromise||(this._initializePromise=this.internalInitialization()),this._initializePromise}async internalInitialization(){return w("__nophysics")?(console.warn("Physics are disabled"),!1):(Ne&&console.log("Initialize rapier physics engine"),this._hasCreatedWorld?(console.error("Invalid call to create physics world: world is already created"),!0):(this._hasCreatedWorld=!0,T.RAPIER_PHYSICS.MAYBEMODULE==null&&(Ne&&console.trace("Loading rapier physics engine"),await(await T.RAPIER_PHYSICS.load()).init()),Ne&&console.log("Physics engine initialized, creating world..."),this._world=new T.RAPIER_PHYSICS.MODULE.World(this._gravity),this.rapierRay=new T.RAPIER_PHYSICS.MODULE.Ray({x:0,y:0,z:0},{x:0,y:0,z:1}),this.enabled=!0,this._isInitialized=!0,Ne&&console.log("Physics world created"),!0))}validate(){this._isInitialized||Ne&&(this._lastWarnTime=this._lastWarnTime??0,Date.now()-this._lastWarnTime>1e3&&(this._lastWarnTime=Date.now(),console.warn("Physics engine is not initialized")))}rapierRay;raycastVectorsBuffer=new Ii(()=>new b,10);raycast(e,t,i){if(!this._isInitialized)return console.log("Physics engine is not initialized"),null;let n=i?.maxDistance,s=i?.solid;n===void 0&&(n=1/0),s===void 0&&(s=!0);const r=this.getPhysicsRay(this.rapierRay,e,t);if(!r)return null;(this.debugRenderRaycasts||Sm)&&B.DrawRay(r.origin,r.dir,255,1);const a=this.world?.castRay(r,n,s,i?.queryFilterFlags,i?.filterGroups,void 0,void 0,l=>{const c=l[Oi];return i?.filterPredicate?i.filterPredicate(c):i?.useIgnoreRaycastLayer!==!1?!c?.gameObject.layers.isEnabled(2):!0});if(a){const l=r.pointAt(a.timeOfImpact),c=this.raycastVectorsBuffer.get();return c.set(l.x,l.y,l.z),{point:c,collider:a.collider[Oi]}}return null}raycastAndGetNormal(e,t,i){if(!this._isInitialized)return null;let n=i?.maxDistance,s=i?.solid;n===void 0&&(n=1/0),s===void 0&&(s=!0);const r=this.getPhysicsRay(this.rapierRay,e,t);if(!r)return null;(this.debugRenderRaycasts||Sm)&&B.DrawRay(r.origin,r.dir,255,1);const a=this.world?.castRayAndGetNormal(r,n,s,i?.queryFilterFlags,i?.filterGroups,void 0,void 0,l=>{const c=l[Oi];return i?.filterPredicate?i.filterPredicate(c):i?.useIgnoreRaycastLayer!==!1?!c?.gameObject.layers.isEnabled(2):!0});if(a){const l=r.pointAt(a.timeOfImpact),c=a.normal,h=this.raycastVectorsBuffer.get(),d=this.raycastVectorsBuffer.get();return h.set(l.x,l.y,l.z),d.set(c.x,c.y,c.z),{point:h,normal:d,collider:a.collider[Oi]}}return null}getPhysicsRay(e,t,i){const n=this.context?.mainCamera;if(t===void 0){const a=this.context?.input.getPointerPosition(0);if(a)t=a;else return null}if(t.z===void 0){if(!n)return console.error("Can not perform raycast from 2d point - no main camera found"),null;const a=this.raycastVectorsBuffer.get();a.x=t.x,a.y=t.y,a.z=0,(a.x>1||a.y>1||a.y<-1||a.x<-1)&&(Ne&&console.warn("Converting screenspace to raycast space",a),this.context?.input.convertScreenspaceToRaycastSpace(a)),a.unproject(n),t=a}const s=t;e.origin.x=s.x,e.origin.y=s.y,e.origin.z=s.z;const r=this.raycastVectorsBuffer.get();if(i)r.set(i.x,i.y,i.z);else{if(!n)return console.error("Can not perform raycast - no camera found"),null;r.set(e.origin.x,e.origin.y,e.origin.z);const a=ee(n);r.sub(a)}return r.normalize(),e.dir.x=r.x,e.dir.y=r.y,e.dir.z=r.z,e}rapierSphere=null;rapierBox=null;rapierColliderArray=[];rapierIdentityRotation={x:0,y:0,z:0,w:1};rapierForwardVector={x:0,y:0,z:1};sphereOverlap(e,t){return this.rapierSphere??=new T.RAPIER_PHYSICS.MODULE.Ball(t),this.rapierSphere.radius=t,(this.debugRenderRaycasts||Sm)&&B.DrawWireSphere(e,t,3359999,1),this.shapeOverlap(e,this.rapierIdentityRotation,this.rapierSphere)}boxOverlap(e,t,i=null){return i===null&&(i=this.rapierIdentityRotation),this.rapierBox??=new T.RAPIER_PHYSICS.MODULE.Cuboid(1,1,1),this.rapierBox.halfExtents.x=t.x*.5,this.rapierBox.halfExtents.y=t.y*.5,this.rapierBox.halfExtents.z=t.z*.5,(this.debugRenderRaycasts||Sm)&&B.DrawWireBox(e,t,3359999,1,!0,i),this.shapeOverlap(e,i,this.rapierBox)}shapeOverlap(e,t,i){return this.rapierColliderArray.length=0,this._isInitialized?this.world?(this.world.intersectionsWithShape(e,t,i,n=>{const s=n[Oi],r=new ov(s.gameObject,s);return this.rapierColliderArray.push(r),!0},void 0,void 0,void 0,void 0,n=>n.isSensor()?!1:n[Oi].gameObject.layers.isEnabled(2)==!1),this.rapierColliderArray):this.rapierColliderArray:this.rapierColliderArray}enabled=!1;get world(){return this._world}_tempPosition=new b;_tempQuaternion=new N;_tempScale=new b;_tempMatrix=new J;static _didLoadPhysicsEngine=!1;_isUpdatingPhysicsWorld=!1;get isUpdating(){return this._isUpdatingPhysicsWorld}_world;_hasCreatedWorld=!1;eventQueue;collisionHandler;objects=[];bodies=[];_meshCache=new Map;_gravity={x:0,y:-9.81,z:0};get gravity(){return this.world?.gravity??this._gravity}set gravity(e){this.world?this.world.gravity=e:this._gravity=e}clearCaches(){this._meshCache.clear(),this.eventQueue?.raw&&this.eventQueue?.free(),this.world?.bodies&&this.world?.free()}async addBoxCollider(e,t){if(this._isInitialized||await this.initialize(),!e.activeAndEnabled)return;if(!this.enabled){Ne&&console.warn("Physics are disabled");return}const i=e.gameObject,n=Ge(i,this._tempPosition).multiply(t);n.multiplyScalar(.5),n.x<0&&(n.x=Math.abs(n.x)),n.y<0&&(n.y=Math.abs(n.y)),n.z<0&&(n.z=Math.abs(n.z));const s=1e-7;n.x<s&&(n.x=s),n.y<s&&(n.y=s),n.z<s&&(n.z=s);const r=T.RAPIER_PHYSICS.MODULE.ColliderDesc.cuboid(n.x,n.y,n.z);this.createCollider(e,r)}async addSphereCollider(e){if(this._isInitialized||await this.initialize(),!e.activeAndEnabled)return;if(!this.enabled){Ne&&console.warn("Physics are disabled");return}const t=T.RAPIER_PHYSICS.MODULE.ColliderDesc.ball(.5);this.createCollider(e,t),this.updateProperties(e)}async addCapsuleCollider(e,t,i){if(this._isInitialized||await this.initialize(),!e.activeAndEnabled)return;if(!this.enabled){Ne&&console.warn("Physics are disabled");return}const n=e.gameObject.worldScale;n.x=Math.abs(n.x),n.y=Math.abs(n.y);const s=i*n.x;t=Math.max(t,s);const r=D.clamp(t*.5*n.y-i*n.x,0,Number.MAX_SAFE_INTEGER),a=T.RAPIER_PHYSICS.MODULE.ColliderDesc.capsule(r,s);this.createCollider(e,a)}async addMeshCollider(e,t,i,n){let s=t.geometry;if(!s){Ne&&console.warn("Missing mesh geometry",t.name);return}s.index?.array?.length||(console.warn(`Your MeshCollider is missing vertices or indices in the assined mesh "${t.name}". Consider providing an indexed geometry.`),s=QP(s));let r=null;const a=s.getAttribute("position");if(a instanceof Lb){const d=a.count;r=new Float32Array(d*3);for(let p=0;p<d;p++){const m=a.getX(p),f=a.getY(p),g=a.getZ(p);r[p*3]=m,r[p*3+1]=f,r[p*3+2]=g}}else r=a.array;if(await this.initialize(),!this.enabled){Ne&&console.warn("Physics are disabled");return}if(!e.activeAndEnabled)return;const l=s.index?.array,c=e.gameObject.worldScale.clone();if(n&&c.multiply(n),Math.abs(c.x-1)>1e-4||Math.abs(c.y-1)>1e-4||Math.abs(c.z-1)>1e-4){const d=`${s.uuid}_${c.x}_${c.y}_${c.z}_${i}`;if(this._meshCache.has(d))Ne&&console.warn("Use cached mesh collider"),r=this._meshCache.get(d);else{(Ne||A())&&console.debug(`[Performance] Your MeshCollider "${e.name}" is scaled: consider applying the scale to the collider mesh instead (${c.x}, ${c.y}, ${c.z})`);const p=new Float32Array(r.length);for(let m=0;m<r.length;m+=3)p[m]=r[m]*c.x,p[m+1]=r[m+1]*c.y,p[m+2]=r[m+2]*c.z;r=p,this._meshCache.set(d,p)}}const h=i?T.RAPIER_PHYSICS.MODULE.ColliderDesc.convexHull(r):T.RAPIER_PHYSICS.MODULE.ColliderDesc.trimesh(r,l);h&&this.createCollider(e,h)}updatePhysicsMaterial(e){if(!e)return;const t=e.sharedMaterial,i=e[jt];if(i&&t){if(t.bounciness!==void 0&&i.setRestitution(t.bounciness),t.bounceCombine!==void 0)switch(t.bounceCombine){case wt.Average:i.setRestitutionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case wt.Maximum:i.setRestitutionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case wt.Minimum:i.setRestitutionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case wt.Multiply:i.setRestitutionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}if(t.dynamicFriction!==void 0&&i.setFriction(t.dynamicFriction),t.frictionCombine!==void 0)switch(t.frictionCombine){case wt.Average:i.setFrictionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case wt.Maximum:i.setFrictionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case wt.Minimum:i.setFrictionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case wt.Multiply:i.setFrictionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}}}getBody(e){return e?e[jt]:null}getComponent(e){return e?e[Oi]:null}createCollider(e,t){if(!this.world)throw new Error("Physics world not initialized");const i=this._tempMatrix;let n;e.attachedRigidbody?n=this.getRigidbody(e,this._tempMatrix):(Ne&&console.log("Create collider without rigidbody",e.name),i.makeRotationFromQuaternion(_e(e.gameObject)),i.setPosition(ee(e.gameObject))),i.decompose(this._tempPosition,this._tempQuaternion,this._tempScale),this.tryApplyCenter(e,this._tempPosition),t.setTranslation(this._tempPosition.x,this._tempPosition.y,this._tempPosition.z),t.setRotation(this._tempQuaternion),t.setSensor(e.isTrigger);const s=e.sharedMaterial;if(s){if(s.bounciness!==void 0&&t.setRestitution(s.bounciness),s.bounceCombine!==void 0)switch(s.bounceCombine){case wt.Average:t.setRestitutionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case wt.Maximum:t.setRestitutionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case wt.Minimum:t.setRestitutionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case wt.Multiply:t.setRestitutionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}if(s.dynamicFriction!==void 0&&t.setFriction(s.dynamicFriction),s.frictionCombine!==void 0)switch(s.frictionCombine){case wt.Average:t.setFrictionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Average);break;case wt.Maximum:t.setFrictionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Max);break;case wt.Minimum:t.setFrictionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Min);break;case wt.Multiply:t.setFrictionCombineRule(T.RAPIER_PHYSICS.MODULE.CoefficientCombineRule.Multiply);break}}e.attachedRigidbody?.autoMass===!1&&(t.setDensity(1e-6),t.setMass(1e-6));try{const r=this.world.createCollider(t,n);return r[Oi]=e,e[jt]=r,r.setActiveEvents(T.RAPIER_PHYSICS.MODULE.ActiveEvents.COLLISION_EVENTS),r.setActiveCollisionTypes(T.RAPIER_PHYSICS.MODULE.ActiveCollisionTypes.ALL),this.objects.push(e),this.bodies.push(r),this.updateColliderCollisionGroups(e),Ne&&console.log("Created collider",e.name,r),r}catch(r){return console.error('Error creating collider "'+e.name+`"
|
|
1731
|
-
Error:`,r),null}}updateColliderCollisionGroups(e){const t=e[jt],i=e.membership;let n=0;if(i==null)n=65535;else for(let a=0;a<i.length;a++){const l=i[a];l>31?console.error(`Rapier only supports 32 layers, layer ${l} is not supported`):n|=1<<Math.floor(l)}const s=e.filter;let r=0;if(s==null)r=65535;else for(let a=0;a<s.length;a++){const l=s[a];l>31?console.error(`Rapier only supports 32 layers, layer ${l} is not supported`):r|=1<<Math.floor(l)}t.setCollisionGroups(n<<16|r)}getRigidbody(e,t){if(!this.world)throw new Error("Physics world not initialized");let i=null;if(e.attachedRigidbody){const n=e.attachedRigidbody;if(i=n[jt],!i){const s=n.isKinematic&&!yb;Ne&&console.log("Create rigidbody",s);const r=s?T.RAPIER_PHYSICS.MODULE.RigidBodyDesc.kinematicPositionBased():T.RAPIER_PHYSICS.MODULE.RigidBodyDesc.dynamic(),a=ee(e.attachedRigidbody.gameObject);r.setTranslation(a.x,a.y,a.z),r.setRotation(_e(e.attachedRigidbody.gameObject)),r.centerOfMass=new T.RAPIER_PHYSICS.MODULE.Vector3(n.centerOfMass.x,n.centerOfMass.y,n.centerOfMass.z),i=this.world.createRigidBody(r),this.bodies.push(i),this.objects.push(n)}i[Oi]=n,n[jt]=i,this.internalUpdateRigidbodyProperties(n,i),this.getRigidbodyRelativeMatrix(e.gameObject,n.gameObject,t),e[QS]=i}else{const n=T.RAPIER_PHYSICS.MODULE.RigidBodyDesc.kinematicPositionBased(),s=ee(e.gameObject);n.setTranslation(s.x,s.y,s.z),n.setRotation(_e(e.gameObject)),i=this.world.createRigidBody(n),t.identity(),i[Oi]=null}return i}internal_getRigidbody(e){return e.isCollider===!0?e[QS]:e[jt]}internalUpdateColliderProperties(e,t){const i=t.shape;let n=!1;switch(i.type){case T.RAPIER_PHYSICS.MODULE.ShapeType.Ball:{const p=i,m=e,f=e.gameObject,g=Ge(f,this._tempPosition),y=Math.abs(m.radius*g.x);n=p.radius!==y,p.radius=y,n&&t.setShape(p);break}case T.RAPIER_PHYSICS.MODULE.ShapeType.Cuboid:const s=i,r=e,a=e.gameObject,l=Ge(a,this._tempPosition),c=Math.abs(r.size.x*.5*l.x),h=Math.abs(r.size.y*.5*l.y),d=Math.abs(r.size.z*.5*l.z);n=s.halfExtents.x!==c||s.halfExtents.y!==h||s.halfExtents.z!==d,s.halfExtents.x=c,s.halfExtents.y=h,s.halfExtents.z=d,n&&t.setShape(s);break}if(n){const s=e.attachedRigidbody;s?.autoMass&&this.getBody(s)?.recomputeMassPropertiesFromColliders()}this.updateColliderCollisionGroups(e),e.isTrigger!==t.isSensor()&&t.setSensor(e.isTrigger)}internalUpdateRigidbodyProperties(e,t){if(t.enableCcd(e.collisionDetectionMode!==Gu.Discrete),t.setLinearDamping(e.drag),t.setAngularDamping(e.angularDrag),t.setGravityScale(e.useGravity?e.gravityScale:0,!0),e.dominanceGroup<=127&&e.dominanceGroup>=-127?t.setDominanceGroup(Math.floor(e.dominanceGroup)):t.setDominanceGroup(0),e.autoMass){t.setAdditionalMass(0,!1);for(let i=0;i<t.numColliders();i++)t.collider(i).setDensity(1);t.recomputeMassPropertiesFromColliders()}else{t.setAdditionalMass(e.mass,!1);for(let i=0;i<t.numColliders();i++)t.collider(i).setDensity(1e-7);t.recomputeMassPropertiesFromColliders()}t.setEnabledRotations(!e.lockRotationX,!e.lockRotationY,!e.lockRotationZ,!1),t.setEnabledTranslations(!e.lockPositionX,!e.lockPositionY,!e.lockPositionZ,!1),e.isKinematic?t.setBodyType(T.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicPositionBased,!1):t.setBodyType(T.RAPIER_PHYSICS.MODULE.RigidBodyType.Dynamic,!1)}lines;disabledLines;step(e){if(this.world&&this.enabled){if(this._isUpdatingPhysicsWorld=!0,this.eventQueue||(this.eventQueue=new T.RAPIER_PHYSICS.MODULE.EventQueue(!1)),e===void 0||e<=0){this._isUpdatingPhysicsWorld=!1;return}else if(e!==void 0){const t=D.lerp(this.world.timestep,e,.8);this.world.timestep=t}try{this.world.step(this.eventQueue)}catch(t){console.warn("Error running physics step",{timestep:this.world.timestep},t)}this._isUpdatingPhysicsWorld=!1}}postStep(){this.world&&this.enabled&&(this._isUpdatingPhysicsWorld=!0,this.syncObjects(),this._isUpdatingPhysicsWorld=!1,this.eventQueue&&!this.collisionHandler&&(this.collisionHandler=new Dj(this.world,this.eventQueue)),this.collisionHandler&&(this.collisionHandler.handleCollisionEvents(),this.collisionHandler.update()),this.updateDebugRendering(this.world))}updateDebugRendering(e){if(Ne||yb||jj||this.debugRenderColliders===!0){if(!this.lines){const n=new Bd({color:7855479,fog:!1}),s=new Yi;this.lines=new Fm(s,n),this.lines.layers.disableAll(),this.lines.layers.enable(2)}if(!this.disabledLines){const n=new Bd({color:14514039,fog:!1}),s=new Yi;this.disabledLines=new Fm(s,n),this.disabledLines.layers.disableAll(),this.disabledLines.layers.enable(2)}this.lines.parent!==this.context?.scene&&this.context?.scene.add(this.lines),this.disabledLines.parent!==this.context?.scene&&this.context?.scene.add(this.disabledLines);const t=e.debugRender(void 0,n=>n.isEnabled());this.lines.geometry.setAttribute("position",new tt(t.vertices,3)),this.lines.geometry.setAttribute("color",new tt(t.colors,4));const i=e.debugRender(void 0,n=>!n.isEnabled());this.disabledLines.geometry.setAttribute("position",new tt(i.vertices,3)),this.disabledLines.geometry.setAttribute("color",new tt(i.colors,4)),this.disabledLines.visible=i.vertices.length>0,(this.context.time.frame%30===0||this.lines.geometry.boundingSphere?.radius===0)&&(this.lines.geometry.computeBoundingSphere(),this.disabledLines.geometry.computeBoundingSphere())}else this.lines&&this.context?.scene.remove(this.lines),this.disabledLines&&this.context?.scene.remove(this.disabledLines)}syncObjects(){if(!yb)for(let e=0;e<this.bodies.length;e++){const t=this.objects[e],i=this.bodies[e],n=t;if(n?.isCollider===!0&&!n.attachedRigidbody){const l=i.parent();l?this.syncPhysicsBody(t.gameObject,l,!0,!0):this.syncPhysicsBody(t.gameObject,i,!0,!0);continue}const s=i.translation(),r=i.rotation();if(Number.isNaN(s.x)||Number.isNaN(r.x)){!n.__COLLIDER_NAN&&A()&&(console.warn("Collider has NaN values",n.name,n.gameObject,i),n.__COLLIDER_NAN=!0);continue}const a=t.center;if(a&&a.isVector3){this._tempQuaternion.set(r.x,r.y,r.z,r.w);const l=this._tempPosition.copy(a).applyQuaternion(this._tempQuaternion),c=Ge(t.gameObject);l.multiply(c),s.x-=l.x,s.y-=l.y,s.z-=l.z}Or(t.gameObject,s.x,s.y,s.z),bg(t.gameObject,r.x,r.y,r.z,r.w)}}syncPhysicsBody(e,t,i,n){if(t instanceof T.RAPIER_PHYSICS.MODULE.RigidBody){const s=ee(e,this._tempPosition),r=_e(e,this._tempQuaternion);switch(t.bodyType()){case T.RAPIER_PHYSICS.MODULE.RigidBodyType.Fixed:case T.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicPositionBased:case T.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicVelocityBased:i&&t.setNextKinematicTranslation(s),n&&t.setNextKinematicRotation(r);break;default:i&&t.setTranslation(s,!1),n&&t.setRotation(r,!1);break}}else if(t instanceof T.RAPIER_PHYSICS.MODULE.Collider){e.matrixWorldNeedsUpdate&&e.updateWorldMatrix(!0,!1),e.matrixWorld.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const s=this._tempPosition,r=this._tempQuaternion,a=t[Oi];if(this.tryApplyCenter(a,s),i){const l=t.translation();(l.x!==s.x||l.y!==s.y||l.z!==s.z)&&t.setTranslation(s)}if(n){const l=t.rotation();(l.x!==r.x||l.y!==r.y||l.z!==r.z||l.w!==r.w)&&t.setRotation(r)}}}_tempCenterPos=new b;_tempCenterVec=new b;_tempCenterQuaternion=new N;tryApplyCenter(e,t){const i=e.center;i&&e.gameObject&&(i.x!==0||i.y!==0||i.z!==0)&&(this._tempCenterPos.x=i.x,this._tempCenterPos.y=i.y,this._tempCenterPos.z=i.z,Ge(e.gameObject,this._tempCenterVec),this._tempCenterPos.multiply(this._tempCenterVec),e.attachedRigidbody?this._tempCenterPos.applyQuaternion(e.gameObject.quaternion):(_e(e.gameObject,this._tempCenterQuaternion),this._tempCenterPos.applyQuaternion(this._tempCenterQuaternion)),t.x+=this._tempCenterPos.x,t.y+=this._tempCenterPos.y,t.z+=this._tempCenterPos.z)}static _matricesBuffer=[];getRigidbodyRelativeMatrix(e,t,i,n){if(n===void 0&&(n=dc._matricesBuffer,n.length=0),e===t){const s=Ge(e,this._tempPosition);i.makeScale(s.x,s.y,s.z);for(let r=n.length-1;r>=0;r--)i.multiply(n[r]);return i}return n.push(e.matrix),e.parent&&this.getRigidbodyRelativeMatrix(e.parent,t,i,n),i}static centerConnectionPos={x:0,y:0,z:0};static centerConnectionRot={x:0,y:0,z:0,w:1};addFixedJoint(e,t){if(!this.world){console.error("Physics world not initialized");return}const i=e[jt],n=t[jt];this.calculateJointRelativeMatrices(e.gameObject,t.gameObject,this._tempMatrix),this._tempMatrix.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const s=T.RAPIER_PHYSICS.MODULE.JointData.fixed(dc.centerConnectionPos,dc.centerConnectionRot,this._tempPosition,this._tempQuaternion),r=this.world.createImpulseJoint(s,i,n,!0);Ne&&console.log("ADD FIXED JOINT",r)}addHingeJoint(e,t,i,n){if(!this.world){console.error("Physics world not initialized");return}const s=e[jt],r=t[jt];this.calculateJointRelativeMatrices(e.gameObject,t.gameObject,this._tempMatrix),this._tempMatrix.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const a=T.RAPIER_PHYSICS.MODULE.JointData.revolute(i,this._tempPosition,n),l=this.world.createImpulseJoint(a,s,r,!0);Ne&&console.log("ADD HINGE JOINT",l)}calculateJointRelativeMatrices(e,t,i){e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);const n=e.matrixWorld,s=t.matrixWorld;n.elements[0]=1,n.elements[5]=1,n.elements[10]=1,s.elements[0]=1,s.elements[5]=1,s.elements[10]=1,i.copy(s).premultiply(n.invert()).invert()}}class Dj{world;eventQueue;constructor(e,t){this.world=e,this.eventQueue=t}activeCollisions=[];activeCollisionsStay=[];activeTriggers=[];handleCollisionEvents(){this.eventQueue&&this.world&&this.eventQueue.drainCollisionEvents((e,t,i)=>{const n=this.world.getCollider(e),s=this.world.getCollider(t);if(!n||!s)return;const r=n[Oi],a=s[Oi];bb&&console.log("EVT",r.name,a.name,i,n,s),r&&a&&(i?(this.onCollisionStarted(r,n,a,s),this.onCollisionStarted(a,s,r,n)):(this.onCollisionEnded(r,a),this.onCollisionEnded(a,r)))})}update(){this.onHandleCollisionStay()}onCollisionStarted(e,t,i,n){let s=null;if(e.isTrigger||i.isTrigger)Wr(e.gameObject,r=>{r.onTriggerEnter&&!r.destroyed&&r.onTriggerEnter(i),this.activeTriggers.push({collider:e,component:r,otherCollider:i})});else{const r=e.gameObject;this.world.contactPair(t,n,(a,l)=>{Wr(r,c=>{if(c.destroyed)return;const h=c.onCollisionEnter||c.onCollisionStay||c.onCollisionExit;if(h||bb){if(!s){const d=[],p=a.normal();i instanceof Ns&&i.convex&&(p.x=-p.x,p.y=-p.y,p.z=-p.z);for(let m=0;m<a.numSolverContacts();m++){const f=a.solverContactPoint(m),g=a.contactImpulse(m);if(f){const y=a.contactDist(m),_=a.solverContactFriction(m),v=a.solverContactTangentVelocity(m),P=new iv(f,y,p,g,_,v);d.push(P),bb&&B.DrawDirection(f,p,16711680,3,!0)}}s=new nv(r,i,d)}if(h){const d={collider:e,component:c,collision:s};this.activeCollisions.push(d),c.onCollisionStay&&this.activeCollisionsStay.push(d),c.onCollisionEnter?.call(c,s)}}})})}}onHandleCollisionStay(){for(const e of this.activeCollisionsStay){const t=e.component;if(!t.destroyed&&t.activeAndEnabled&&t.onCollisionStay){if(e.collision.collider.destroyed)continue;const i=e.collision;t.onCollisionStay(i)}}for(const e of this.activeTriggers){const t=e.component;if(!t.destroyed&&t.activeAndEnabled&&t.onTriggerStay){const i=e.otherCollider;if(i.destroyed)continue;t.onTriggerStay(i)}}}onCollisionEnded(e,t){if(!(e.destroyed||t.destroyed)){for(let i=0;i<this.activeCollisions.length;i++){const n=this.activeCollisions[i],s=n.collider;if(s.destroyed||n.collision.collider.destroyed){this.activeCollisions.splice(i,1),i--;continue}if(s===e&&n.collision.collider===t){const r=n.component;if(this.activeCollisions.splice(i,1),i--,r.activeAndEnabled&&r.onCollisionExit){const a=n.collision;r.onCollisionExit(a)}}}for(let i=0;i<this.activeCollisionsStay.length;i++){const n=this.activeCollisionsStay[i],s=n.collider;if(s.destroyed||n.collision.collider.destroyed){this.activeCollisionsStay.splice(i,1),i--;continue}if(s===e&&n.collision.collider===t){const r=n.component;if(this.activeCollisionsStay.splice(i,1),i--,r.activeAndEnabled&&r.onCollisionExit){const a=n.collision;r.onCollisionExit(a)}}}for(let i=0;i<this.activeTriggers.length;i++){const n=this.activeTriggers[i],s=n.collider;if(s.destroyed||n.otherCollider.destroyed){this.activeTriggers.splice(i,1),i--;continue}if(s===e&&n.otherCollider===t){const r=n.component;if(this.activeTriggers.splice(i,1),i--,r.activeAndEnabled&&r.onTriggerExit){const a=n.otherCollider;r.onTriggerExit(a)}}}}}}let _b=0;function YS(o){o?_b++:_b--}function Bj(){return _b>0}const Fj={binary:!0,animations:!0};async function Uj(o){if(!o.context)throw new Error("No context provided to exportAsGLTF");o.scene||(o.scene=o.context.scene);const e={...Fj,...o},{context:t}=e,i=new Xb;i.register(a=>new g1(a)),i.register(a=>new OA(a)),i.register(a=>new y1(a)),Oy(i,e.context);const n={binary:e.binary,animations:Nj(t,e.scene,[])},s=new zj;console.debug("Exporting GLTF",n),s.onBeforeExport(e),YS(!0);const r=await i.parseAsync(e.scene,n).catch(a=>(console.error(a),null));if(YS(!1),s.onAfterExport(e),!r)throw new Error("Failed to export GLTF");if(e.downloadAs!=null){let a=null;if(r instanceof ArrayBuffer?a=new Blob([r],{type:"application/octet-stream"}):console.error("Can not download GLTF as a blob",r),a){const l=URL.createObjectURL(a),c=document.createElement("a");c.href=l;let h=e.downloadAs;!h.endsWith(".glb")&&!h.endsWith(".gltf")&&(h+=e.binary?".glb":".gltf"),c.download=h,c.click()}}return r}const ZS=Symbol("needle:weight");class zj{_undo=[];onBeforeExport(e){e.context.animations.mixers.forEach(t=>{const i=Kn.tryGetActionsFromMixer(t);if(i)for(let n=0;n<i.length;n++){const s=i[n];s[ZS]=s.weight,s.weight=0,this._undo.push(()=>{s.weight=s[ZS]})}t.update(0)}),e.context.scene.traverse(t=>{if(!Iy(t)){const i=t.parent;i&&(t.removeFromParent(),this._undo.push(()=>i.add(t)))}})}onAfterExport(e){this._undo.forEach(t=>t()),this._undo.length=0}}function Nj(o,e,t){o.animations.mixers.forEach(n=>{const s=Kn.tryGetActionsFromMixer(n);if(s)for(let r=0;r<s.length;r++){const a=s[r].getClip();t.push(a)}}),Array.isArray(e)||(e=[e]);for(const n of e)Kn.tryGetAnimationClipsFromObjectHierarchy(n,t);const i=new Set(t);return Array.from(i)}const yd=w("debugavatar");class vb{root;head;leftHand;rigthHand;get isValid(){return this.head!==null&&this.head!==void 0}constructor(e,t,i,n){this.root=e,this.head=t,this.leftHand=i,this.rigthHand=n,this.root?.traverse(s=>s.layers.set(2))}}class KS{avatarRegistryUrl=null;async getOrCreateNewAvatarInstance(e,t){if(!t)return console.error("Can not create avatar: failed to provide id or root object"),null;let i=null;if(typeof t=="string"){if(i=await this.loadAvatar(e,t),!i){const s=new Gn;i=S.instantiate(za(t,e.scene),s)}}else i=t;if(!i)return null;const n=this.findAvatar(i);return n.isValid?(yd&&console.log("[Custom Avatar] valid config",t,yd?n:""),n):(console.warn("[Custom Avatar] config isn't valid",t,yd?n:""),null)}async loadAvatar(e,t){if(console.assert(t!=null&&typeof t=="string","Avatar id must not be null"),t.length<=0||!t)return null;if(yd&&console.log("[Custom Avatar] "+t+", loading..."),t.endsWith(".glb")||(t+=".glb"),this.avatarRegistryUrl===null){const n=await fetch("./"+t);let s=null;if(n.ok){const r=await n.blob();r&&(s=await r.arrayBuffer())}return s?(await kn().parseSync(e,s,null,0))?.scene??null:null}const i=new Do;return n0(i,e),new Promise((n,s)=>{const r=this.avatarRegistryUrl+"/"+t;i.load(r,async a=>{await kn().createBuiltinComponents(e,r,a,null,void 0),n(a.scene)},a=>{yd&&console.log("[Custom Avatar] "+a.loaded/a.total*100+"% loaded of "+a.total/1024+"kB")},a=>{console.error("[Custom Avatar] Error when loading: "+a),n(null)})})}cacheModel(e,t){}findAvatar(e){const t=e;let i=t;i.children.length==1&&(i=e.children[0]);let n=this.findAvatarPart(i,["head"]);const s=this.findAvatarPart(i,["left","hand"]),r=this.findAvatarPart(i,["right","hand"]);if(!n){n=t;const a=new b;new Nt().setFromObject(n).getSize(a);const l=Math.max(a.x,a.y,a.z);console.warn("[Custom Avatar] Normalizing head scale, it's too big: "+l+" meters! Should be < 0.3m"),l>.3&&n.scale.multiplyScalar(1/l*.3)}return new vb(t,n,s,r)}findAvatarPart(e,t){const i=e.name.toLowerCase();let n=!0;for(const s of t){if(!n)break;i.indexOf(s)===-1&&(n=!1)}if(n)return e;if(e.children)for(const s of e.children){const r=this.findAvatarPart(s,t);if(r)return r}return null}handleCustomAvatarErrors(e){if(!e.ok)throw Error(e.statusText);return e}}class JS{get extensionName(){return"DocumentExtension"}onAfterBuildDocument(e){}}class eC{}const Wj=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:fe,ActionCollection:z1,ActionModel:ki,AlignmentConstraint:uh,Animation:Vt,AnimationCurve:jh,AnimationExtension:Ap,AnimationTrackHandler:ah,Animator:vt,AnimatorController:bn,Antialiasing:zh,Attractor:Gl,AudioExtension:Ma,AudioListener:Go,AudioSource:Ui,AudioTrackHandler:_s,Avatar:Gs,AvatarBlink_Simple:Yr,AvatarEyeLook_Rotation:ay,AvatarLoader:KS,AvatarMarker:Le,AvatarModel:vb,Avatar_Brain_LookAt:ph,Avatar_MouthShapes:mh,Avatar_MustacheShake:sy,Avatar_POI:Qr,AxesHelper:fl,BaseUIComponent:gn,BasicIKConstraint:cy,BehaviorExtension:s0,BehaviorModel:Ft,BloomEffect:om,BoxCollider:lp,BoxGizmo:la,BoxHelperComponent:zt,Button:cs,CallInfo:Ho,Camera:_i,CameraTargetReachedEvent:oh,Canvas:Fl,CanvasGroup:Ks,CapsuleCollider:qo,ChangeMaterialOnClick:qy,ChangeTransformOnClick:oa,CharacterController:Zr,CharacterControllerInput:Qo,ChromaticAberration:Nh,ClickThrough:bm,ColorAdjustments:sr,ColorBySpeedModule:$l,ColorOverLifetimeModule:Zp,ContactShadows:fh,ControlTrackHandler:ep,CursorFollow:xa,CustomBranding:aa,Deletable:my,DeleteBox:br,DepthOfField:Nn,DeviceFlag:cp,DocumentExtension:JS,DragControls:Jr,DropListener:Jo,Duplicatable:Ry,EffectWrapper:Vh,EmissionModule:rs,EmphasizeOnClick:Rl,EnvironmentScene:tp,EventList:oe,EventListEvent:Vu,EventSystem:ci,EventTrigger:xp,FieldWithDefault:m1,FixedJoint:S0,Fog:Ul,GltfExport:Dy,GltfExportBox:Ly,Gradient:ha,Graphic:Th,GraphicRaycaster:Xu,GridHelper:zl,GridLayoutGroup:m0,GroundProjectedEnv:so,GroupActionModel:na,HideOnStart:_n,HingeJoint:Lh,HorizontalLayoutGroup:p0,get HoverAnimation(){return Po},Image:Yl,InheritVelocityModule:R0,InputField:tb,InstanceHandle:Ia,InstancingHandler:Ea,Interactable:py,Keyframe:Si,LODGroup:$p,LODModel:Wl,Light:It,LimitVelocityOverLifetimeModule:pt,LogStats:uy,LookAt:ib,LookAtConstraint:Hr,MainModule:Qt,MarkerTrackHandler:Ju,MaskableGraphic:Ah,MeshCollider:Ns,MeshRenderer:_h,MinMaxCurve:Y,MinMaxGradient:da,NeedleMenu:_o,NestedGltf:Vl,Networking:k0,NoiseModule:ve,ObjectRaycaster:nn,OffsetConstraint:ca,OpenURL:Zl,OrbitControls:me,Outline:Dl,Padding:ra,ParticleBurst:Yp,ParticleSubEmitter:T0,ParticleSystem:Fh,ParticleSystemRenderer:dn,PhysicsExtension:r0,PixelationEffect:$h,PlayAnimationOnClick:xh,PlayAudioOnClick:Hs,PlayableDirector:ml,PlayerColor:lc,PointerEventData:Cd,PostProcessingHandler:cc,PreliminaryAction:Tl,PreliminaryTrigger:Sh,RawImage:gm,Rect:Z1,RectTransform:Un,ReflectionProbe:Zo,RegisteredAnimationInfo:_r,RemoteSkybox:sp,Renderer:ni,RendererLightmap:ky,Rigidbody:Je,RotationBySpeedModule:hn,RotationOverLifetimeModule:zn,SceneSwitcher:et,ScreenCapture:rr,ScreenSpaceAmbientOcclusion:as,ScreenSpaceAmbientOcclusionN8:Wn,ScrollFollow:hs,SeeThrough:ls,SetActiveOnClick:Xy,ShadowCatcher:Yh,ShapeModule:E0,SharpeningEffect:Gh,SignalAsset:Ku,SignalReceiver:rh,SignalReceiverEvent:sh,SignalTrackHandler:lh,Size:Y1,SizeBySpeedModule:Ci,SizeOverLifetimeModule:ua,SkinnedMeshRenderer:My,SmoothFollow:cm,SpatialGrabRaycaster:ka,SpatialHtml:td,SpatialTrigger:hm,SpatialTriggerReceiver:So,SpectatorCamera:dm,SphereCollider:yl,SplineContainer:_a,SplineData:Co,SplineWalker:pn,Sprite:ts,SpriteData:Il,SpriteRenderer:wi,SpriteSheet:Al,SubEmitterSystem:tm,SyncedCamera:Q0,SyncedRoom:Vn,SyncedTransform:Ln,TapGestureTrigger:Yy,TeleportTarget:Fp,TestRunner:K0,TestSimulateUserData:J0,Text:Xt,TextBuilder:d0,TextExtension:Wp,TextureSheetAnimationModule:Yt,TiltShiftEffect:xo,ToneMappingEffect:or,TrailModule:Ue,TransformData:Ve,TransformGizmo:va,TriggerBuilder:qt,TriggerModel:mr,UIRaycastUtils:Hf,UIRootComponent:Mh,USDZExporter:wo,USDZText:Bl,USDZUIExtension:y0,UsageMarker:yh,VariantAction:Hy,VelocityOverLifetimeModule:Xe,VerticalLayoutGroup:u0,VideoPlayer:gt,get ViewBox(){return at},Vignette:fa,VisibilityAction:Ch,Voip:zs,Volume:ba,VolumeParameter:U,VolumeProfile:im,WebARCameraBackground:rd,WebARSessionRoot:vn,WebXR:Up,WebXRImageTracking:ad,WebXRImageTrackingModel:us,WebXRPlaneTracking:ps,WebXRTrackedImage:hc,XRControllerFollow:ds,XRControllerModel:is,XRControllerMovement:Wi,XRFlag:sn,XRRig:xm,XRState:li,__Ignore:eC},Symbol.toStringTag,{value:"Module"}));var wb;(o=>{function e(t,i=!1,n=.75){const s=new _a,r=1-D.clamp(n,0,1);return t.forEach((a,l)=>{const c=new b;l<t.length-1?c.subVectors(t[l+1],a).normalize().multiplyScalar(r):i&&t.length>1&&c.subVectors(t[0],a).normalize().multiplyScalar(r);const h=new Co;h.position.copy(a),h.tangentIn.copy(c),h.tangentOut.copy(c),s.addKnot(h)}),s.closed=i,s}o.createFromPoints=e})(wb||(wb={}));class Vj extends rO{constructor(){super(new Worker(URL.createObjectURL(new Blob([`import '${new URL("./generateMeshBVH.worker-DiCnZlf3.js",import.meta.url).toString()}';`],{type:"text/javascript"})),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(e,t,i={}){return new Promise((n,s)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=c=>{s(new Error(`[GenerateMeshBVHWorker] ${c.message||"Unknown error. Please check the server console. If you're using vite try adding 'three-mesh-bvh' to 'optimizeDeps.exclude' in your vite.config.js"}`))},e.onmessage=c=>{const{data:h}=c;if(h.error)s(new Error(h.error)),e.onmessage=null;else if(h.serialized){const{serialized:d,position:p}=h,m=aO.deserialize(d,t,{setIndex:!1}),f=Object.assign({setBoundingBox:!0},i);if(t.attributes.position.array=p,d.index)if(t.index)t.index.array=d.index;else{const g=new tt(d.index,1,!1);t.setIndex(g)}f.setBoundingBox&&(t.boundingBox=m.getBoundingBox(new Nt)),i.onProgress&&i.onProgress(h.progress),n(m),e.onmessage=null}else i.onProgress&&i.onProgress(h.progress)};const r=t.index?t.index.array:null,a=t.attributes.position.array,l=[a];r&&l.push(r),e.postMessage({index:r,position:a,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...t.groups]}},l.map(c=>c.buffer).filter(c=>typeof SharedArrayBuffer>"u"||!(c instanceof SharedArrayBuffer)))})}}const $j=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:Vj},Symbol.toStringTag,{value:"Module"}));export{tv as $componentName,Hk as $physicsKey,fe as ActionBuilder,z1 as ActionCollection,ki as ActionModel,Ev as Addressables,uh as AlignmentConstraint,Ka as AmbientMode,Vt as Animation,jh as AnimationCurve,Ap as AnimationExtension,ah as AnimationTrackHandler,Kn as AnimationUtils,vt as Animator,As as AnimatorConditionMode,bn as AnimatorController,Uf as AnimatorControllerParameterType,Qc as AnimatorStateInfo,zh as Antialiasing,Hn as Application,Dw as AssetDatabase,ne as AssetReference,Gl as Attractor,Nf as AudioClip,Ma as AudioExtension,Go as AudioListener,Ui as AudioSource,_s as AudioTrackHandler,Gs as Avatar,Yr as AvatarBlink_Simple,ay as AvatarEyeLook_Rotation,KS as AvatarLoader,Le as AvatarMarker,vb as AvatarModel,ph as Avatar_Brain_LookAt,mh as Avatar_MouthShapes,sy as Avatar_MustacheShake,Qr as Avatar_POI,dl as Axes,fl as AxesHelper,Sc as BUILD_TIME,gn as BaseUIComponent,cy as BasicIKConstraint,s0 as BehaviorExtension,Ft as BehaviorModel,Ar as BlobStorage,om as BloomEffect,lp as BoxCollider,la as BoxGizmo,zt as BoxHelperComponent,cs as Button,fn as ButtonsFactory,zx as CallDirection,Ho as CallInfo,_i as Camera,oh as CameraTargetReachedEvent,Fl as Canvas,Ks as CanvasGroup,qo as CapsuleCollider,qy as ChangeMaterialOnClick,oa as ChangeTransformOnClick,Zr as CharacterController,Qo as CharacterControllerInput,Nh as ChromaticAberration,Ii as CircularBuffer,qr as ClearFlags,bm as ClickThrough,ao as ClipExtrapolation,rn as Collider,nv as Collision,Gu as CollisionDetectionMode,sr as ColorAdjustments,$l as ColorBySpeedModule,Zp as ColorOverLifetimeModule,tR as Component,E as Component$1,Cu as ComponentLifecycleEvents,Wj as Components,Hv as ConnectionEvents,iv as ContactPoint,fh as ContactShadows,z as Context,fE as ContextArgs,ue as ContextEvent,pe as ContextRegistry,ep as ControlTrackHandler,xa as CursorFollow,aa as CustomBranding,Te as CustomShader,_u as DefaultReflectionMode,my as Deletable,br as DeleteBox,Nn as DepthOfField,cp as DeviceFlag,I as DeviceUtilities,JS as DocumentExtension,Jr as DragControls,fy as DragMode,Jo as DropListener,Ry as Duplicatable,Vh as EffectWrapper,rs as EmissionModule,Rl as EmphasizeOnClick,kd as EngineLoadingView,tp as EnvironmentScene,oe as EventList,Vu as EventListEvent,ci as EventSystem,xp as EventTrigger,m1 as FieldWithDefault,Aa as FileReference,Tv as FileReferenceSerializer,VT as FileSpawnModel,Yx as File_Event,S0 as FixedJoint,Ul as Fog,xe as FrameEvent,Ha as GENERATOR,S as GameObject,B as Gizmos,Dy as GltfExport,Ly as GltfExportBox,ha as Gradient,Th as Graphic,Xu as GraphicRaycaster,fr as Graphics,zl as GridHelper,m0 as GridLayoutGroup,so as GroundProjectedEnv,na as GroupActionModel,iu as HideFlags,_n as HideOnStart,Lh as HingeJoint,p0 as HorizontalLayoutGroup,HE as HostData,Po as HoverAnimation,Yl as Image,Ta as ImageReference,Rv as ImageReferenceSerializer,R0 as InheritVelocityModule,Dv as Input,fi as InputEventQueue,Ie as InputEvents,tb as InputField,Ia as InstanceHandle,Ea as InstancingHandler,yn as InstancingUtil,Kw as InstantiateEvent,Ut as InstantiateIdProvider,Gn as InstantiateOptions,py as Interactable,sd as InternalScreenshotUtils,LM as JoinedRoomResponse,OM as KeyEventArgs,Si as Keyframe,$p as LODGroup,Wl as LODModel,jM as LeftRoomResponse,It as Light,Jv as LightData,pt as LimitVelocityOverLifetimeModule,kj as LoadingElementOptions,uy as LogStats,Li as LogType,ib as LookAt,Hr as LookAtConstraint,T as MODULES,Qt as MainModule,Ju as MarkerTrackHandler,Yf as MarkerType,Ah as MaskableGraphic,ys as MaterialPropertyBlock,fp as MaterialX,D as Mathf,Ns as MeshCollider,_h as MeshRenderer,Y as MinMaxCurve,da as MinMaxGradient,Rg as NEEDLE_ENGINE_FEATURE_FLAGS,Rc as NEKeyboardEvent,No as NEPointerEvent,VS as NeedleButtonElement,by as NeedleEngineModelLoader,fb as NeedleEngineWebComponent,_o as NeedleMenu,tu as NeedlePatchesKey,xf as NeedleXRController,Z as NeedleXRSession,Ow as NeedleXRSync,Rw as NeedleXRUtils,Vl as NestedGltf,qv as NetworkConnection,co as NetworkedStreamEvents,Pd as NetworkedStreams,k0 as Networking,ex as NewInstanceModel,ve as NoiseModule,nn as ObjectRaycaster,Rs as ObjectUtils,ca as OffsetConstraint,Gd as OneEuroFilter,ug as OneEuroFilterXYZ,Zl as OpenURL,me as OrbitControls,Dl as Outline,Gv as OwnershipEvent,cf as OwnershipModel,Os as PUBLIC_KEY,ra as Padding,Yp as ParticleBurst,T0 as ParticleSubEmitter,Fh as ParticleSystem,nr as ParticleSystemBaseBehaviour,dn as ParticleSystemRenderer,Qp as ParticleSystemShapeType,vs as PeerHandle,Vv as PeerNetworking,rc as Physics,r0 as PhysicsExtension,wt as PhysicsMaterialCombine,$h as PixelationEffect,xh as PlayAnimationOnClick,Hs as PlayAudioOnClick,ml as PlayableDirector,lc as PlayerColor,ln as PlayerState,$1 as PlayerStateEvent,Jy as PlayerSync,Xv as PlayerView,Qv as PlayerViewManager,Cd as PointerEventData,mu as PointerType,st as PostProcessingEffect,mt as PostProcessingEffectOrder,cc as PostProcessingHandler,Tl as PreliminaryAction,Sh as PreliminaryTrigger,Ws as PreviewHelper,Qa as PrimitiveType,le as Progress,sg as PromiseAllWithErrors,og as PromiseErrorResult,re as RGBAColor,dc as RapierPhysics,gm as RawImage,Ts as RaycastOptions,Z1 as Rect,Un as RectTransform,Zo as ReflectionProbe,_r as RegisteredAnimationInfo,sp as RemoteSkybox,Eo as RenderTexture,gx as RenderTextureSerializer,ni as Renderer,Kv as RendererData,ky as RendererLightmap,Je as Rigidbody,Ke as RigidbodyConstraints,ie as RoomEvents,hn as RotationBySpeedModule,zn as RotationOverLifetimeModule,gp as SceneLightSettings,et as SceneSwitcher,rr as ScreenCapture,as as ScreenSpaceAmbientOcclusion,Wn as ScreenSpaceAmbientOcclusionN8,hs as ScrollFollow,ls as SeeThrough,En as SendQueue,Yg as SerializationContext,Xy as SetActiveOnClick,Yh as ShadowCatcher,E0 as ShapeModule,ov as ShapeOverlapResult,Gh as SharpeningEffect,Ku as SignalAsset,rh as SignalReceiver,sh as SignalReceiverEvent,lh as SignalTrackHandler,Y1 as Size,Ci as SizeBySpeedModule,ua as SizeOverLifetimeModule,My as SkinnedMeshRenderer,cm as SmoothFollow,ka as SpatialGrabRaycaster,td as SpatialHtml,hm as SpatialTrigger,So as SpatialTriggerReceiver,dm as SpectatorCamera,yl as SphereCollider,Tf as SphereIntersection,_a as SplineContainer,Co as SplineData,wb as SplineUtils,pn as SplineWalker,ts as Sprite,Il as SpriteData,wi as SpriteRenderer,Al as SpriteSheet,XE as StateMachineBehaviour,ny as StreamEndedEvent,Ux as StreamReceivedEvent,tm as SubEmitterSystem,Q0 as SyncedCamera,Vn as SyncedRoom,Ln as SyncedTransform,Yy as TapGestureTrigger,Fp as TeleportTarget,K0 as TestRunner,J0 as TestSimulateUserData,Xt as Text,d0 as TextBuilder,Wp as TextExtension,Yt as TextureSheetAnimationModule,xo as TiltShiftEffect,tw as Time,or as ToneMappingEffect,pl as TrackHandler,zi as TrackType,Ue as TrailModule,Ve as TransformData,va as TransformGizmo,qt as TriggerBuilder,mr as TriggerModel,C as TypeStore,Hf as UIRaycastUtils,Mh as UIRootComponent,By as USDDocument,lt as USDObject,S1 as USDWriter,P1 as USDZExporter,wo as USDZExporter$1,Bl as USDZText,y0 as USDZUIExtension,fx as UriSerializer,yh as UsageMarker,DM as UserJoinedOrLeftRoomModel,mi as VERSION,Hy as VariantAction,Xe as VelocityOverLifetimeModule,u0 as VerticalLayoutGroup,gt as VideoPlayer,at as ViewBox,Wo as ViewDevice,fa as Vignette,Ch as VisibilityAction,zs as Voip,ba as Volume,U as VolumeParameter,im as VolumeProfile,xM as WaitForFrames,Iv as WaitForPromise,tf as WaitForSeconds,fs as Watch,rd as WebARCameraBackground,vn as WebARSessionRoot,Up as WebXR,gr as WebXRButtonFactory,ad as WebXRImageTracking,us as WebXRImageTrackingModel,ps as WebXRPlaneTracking,hc as WebXRTrackedImage,ds as XRControllerFollow,is as XRControllerModel,Wi as XRControllerMovement,sn as XRFlag,xm as XRRig,li as XRState,uo as XRStateFlag,eC as __Ignore,BE as __internalNotifyObjectDestroyed,Jn as activeInHierarchyFieldName,ig as addAttributeChangeCallback,Tn as addComponent,pA as addCustomExtensionPlugin,jr as addNewComponent,eu as addPatch,Pu as apply,eR as applyHMRChanges,mw as applyPrototypeExtensions,Jw as beginListenDestroy,ix as beginListenInstantiate,rf as binaryIdentifierCasts,gE as build_scene_functions,Tr as builtinComponentKeyName,gb as calculateProgress01,FO as clearMessages,yx as colorSerializer,xv as compareAssociation,Kc as componentSerializer,B_ as copyTexture,rx as createMotion,yi as debugNet,Ac as debugOwner,R1 as decompressGpuTexture,fc as deepClone,Fo as delay,Wd as delayForFrames,uu as deserializeObject,Bi as destroy,bw as destroyComponentInstance,Zx as determineMimeTypeFromExtension,Me as disposeObjectResources,ho as disposeStream,Cc as editorGuidKeyName,$a as enableSpatialConsole,bx as eventListSerializer,Uj as exportAsGLTF,Lf as findByGuid,nl as findObjectOfType,ww as findObjectsOfType,Af as findResourceUsers,Sx as fitCamera,U_ as fitObjectIntoVolume,Wr as foreachComponent,Fu as foreachComponentEnumerator,nk as forward,lw as generateQRCode,tx as generateSeed,ui as getBoundingBox,C_ as getCameraController,Dr as getComponent,Fc as getComponentInChildren,Uc as getComponentInParent,Bc as getComponents,il as getComponentsInChildren,Ou as getComponentsInParent,_1 as getFormattedDate,kt as getIconElement,gf as getIconTexture,kn as getLoader,Dc as getOrAddComponent,w as getParam,rk as getParentHierarchyPath,fO as getPath,RM as getPeerOptions,Nv as getPeerjsInstance,UE as getResourceUserCount,M_ as getTempColor,di as getTempQuaternion,F as getTempVector,mc as getUrlParams,F_ as getVisibleInCustomShadowRendering,A_ as getWorldDirection,_g as getWorldEuler,ee as getWorldPosition,_e as getWorldQuaternion,Yd as getWorldRotation,Ge as getWorldScale,io as hasCommercialLicense,kc as hasIndieLicense,qu as hasPointerEventComponent,to as hasProLicense,$_ as hideDebugConsole,T1 as imageToCanvas,Av as initAddressableSerializers,_x as initBuiltinSerializers,Lj as initEngine,Lx as initVolumeParameterSerializer,Vr as instantiate,c1 as invokeLoadedImportPluginHooks,rw as invokeXRSessionEnd,sw as invokeXRSessionStart,$w as isActiveInHierarchy,ll as isActiveSelf,xO as isAndroidDevice,D_ as isAnimationAction,Mg as isComponent,uO as isDebugMode,bO as isDesktop,Nr as isDestroyed,A as isDevEnvironment,DE as isDisposed,Bj as isExporting,ev as isGLTFModel,r_ as isHostedOnGlitch,zf as isHotReloadEnabled,KE as isHotReloading,vO as isIPad,cw as isIconElement,Ai as isLocalNetwork,CO as isMacOS,_O as isMobileDevice,SO as isMozillaXR,kO as isQuest,Fw as isResourceTrackingEnabled,OO as isSafari,ju as isUsingInstancing,PO as isiOS,wO as isiPad,_j as loadAsset,iy as loadPMREM,pb as loadSync,Zd as logHierarchy,QO as lookAtInverse,yc as lookAtObject,YO as lookAtScreenPoint,mO as makeId,d_ as makeIdFromRandomWords,Ni as makeNameSafe,Hw as markAsInstancedRendered,MO as microphonePermissionsGranted,dO as nameof,a_ as nameofFactory,Wf as objectSerializer,qM as offXRSessionEnd,GM as offXRSessionStart,eM as onAfterRender,Jk as onBeforeRender,Zk as onClear,Kk as onDestroy,zg as onInitialized,au as onStart,yv as onUpdate,pf as onXRSessionEnd,vu as onXRSessionStart,US as parseSync,z_ as placeOnSurface,xg as postprocessFBXMaterials,OR as prefix,l_ as pushState,gO as randomNumber,af as registerBinaryType,ku as registerComponent,Py as registerComponentExtension,un as registerCustomEffectType,Oy as registerExportExtensions,bp as registerExtensions,cx as registerHotReloadType,av as registerLoader,ox as registerPrefabProvider,_f as registerPrototypeExtensions,Pg as registerType,p_ as relativePathPrefix,ng as removeAttributeChangeCallback,vf as removeComponent,mA as removeCustomImportExtensionType,Wk as removePatch,Qn as resolveUrl,u_ as sanitizeString,IS as saveImage,JL as screenshot,lb as screenshot2,Bf as sendDestroyed,u as serializable,Ov as serializeObject,qe as serializeable,qc as setActive,y_ as setAllowBalloonMessages,LO as setAllowOverlayMessages,Xd as setAutoFitEnabled,pg as setCameraController,qw as setDestroyed,VO as setDevEnvironment,zw as setDisposable,cl as setDontDestroy,Jm as setOrAddParamsToUrl,pO as setParam,gc as setParamWithoutReload,TM as setPeerOptions,jE as setResourceTrackingEnabled,eg as setState,wg as setVisibleInCustomShadowRendering,vg as setWorldEuler,bt as setWorldPosition,Or as setWorldPositionXYZ,On as setWorldQuaternion,bg as setWorldQuaternionXYZW,j_ as setWorldRotation,bc as setWorldRotationXYZ,Va as setWorldScale,wc as showBalloonError,ke as showBalloonMessage,be as showBalloonWarning,Sg as showDebugConsole,O_ as slerp,Xc as syncDestroy,ty as syncField,Ff as syncInstantiate,ak as textureToCanvas,m_ as toSourceId,Uv as tryCastBinary,Jx as tryDetermineMimetypeFromBinary,Kx as tryDetermineMimetypeFromURL,za as tryFindObject,zv as tryGetGuid,hx as unregisterHotReloadType,tg as unwatchWrite,P_ as useForAutoFit,Mt as validate,$d as watchWrite};
|
|
1731
|
+
Error:`,r),null}}updateColliderCollisionGroups(e){const t=e[jt],i=e.membership;let n=0;if(i==null)n=65535;else for(let a=0;a<i.length;a++){const l=i[a];l>31?console.error(`Rapier only supports 32 layers, layer ${l} is not supported`):n|=1<<Math.floor(l)}const s=e.filter;let r=0;if(s==null)r=65535;else for(let a=0;a<s.length;a++){const l=s[a];l>31?console.error(`Rapier only supports 32 layers, layer ${l} is not supported`):r|=1<<Math.floor(l)}t.setCollisionGroups(n<<16|r)}getRigidbody(e,t){if(!this.world)throw new Error("Physics world not initialized");let i=null;if(e.attachedRigidbody){const n=e.attachedRigidbody;if(i=n[jt],!i){const s=n.isKinematic&&!yb;Ne&&console.log("Create rigidbody",s);const r=s?T.RAPIER_PHYSICS.MODULE.RigidBodyDesc.kinematicPositionBased():T.RAPIER_PHYSICS.MODULE.RigidBodyDesc.dynamic(),a=ee(e.attachedRigidbody.gameObject);r.setTranslation(a.x,a.y,a.z),r.setRotation(_e(e.attachedRigidbody.gameObject)),r.centerOfMass=new T.RAPIER_PHYSICS.MODULE.Vector3(n.centerOfMass.x,n.centerOfMass.y,n.centerOfMass.z),i=this.world.createRigidBody(r),this.bodies.push(i),this.objects.push(n)}i[Oi]=n,n[jt]=i,this.internalUpdateRigidbodyProperties(n,i),this.getRigidbodyRelativeMatrix(e.gameObject,n.gameObject,t),e[QS]=i}else{const n=T.RAPIER_PHYSICS.MODULE.RigidBodyDesc.kinematicPositionBased(),s=ee(e.gameObject);n.setTranslation(s.x,s.y,s.z),n.setRotation(_e(e.gameObject)),i=this.world.createRigidBody(n),t.identity(),i[Oi]=null}return i}internal_getRigidbody(e){return e.isCollider===!0?e[QS]:e[jt]}internalUpdateColliderProperties(e,t){const i=t.shape;let n=!1;switch(i.type){case T.RAPIER_PHYSICS.MODULE.ShapeType.Ball:{const p=i,m=e,f=e.gameObject,g=Ge(f,this._tempPosition),y=Math.abs(m.radius*g.x);n=p.radius!==y,p.radius=y,n&&t.setShape(p);break}case T.RAPIER_PHYSICS.MODULE.ShapeType.Cuboid:const s=i,r=e,a=e.gameObject,l=Ge(a,this._tempPosition),c=Math.abs(r.size.x*.5*l.x),h=Math.abs(r.size.y*.5*l.y),d=Math.abs(r.size.z*.5*l.z);n=s.halfExtents.x!==c||s.halfExtents.y!==h||s.halfExtents.z!==d,s.halfExtents.x=c,s.halfExtents.y=h,s.halfExtents.z=d,n&&t.setShape(s);break}if(n){const s=e.attachedRigidbody;s?.autoMass&&this.getBody(s)?.recomputeMassPropertiesFromColliders()}this.updateColliderCollisionGroups(e),e.isTrigger!==t.isSensor()&&t.setSensor(e.isTrigger)}internalUpdateRigidbodyProperties(e,t){if(t.enableCcd(e.collisionDetectionMode!==Gu.Discrete),t.setLinearDamping(e.drag),t.setAngularDamping(e.angularDrag),t.setGravityScale(e.useGravity?e.gravityScale:0,!0),e.dominanceGroup<=127&&e.dominanceGroup>=-127?t.setDominanceGroup(Math.floor(e.dominanceGroup)):t.setDominanceGroup(0),e.autoMass){t.setAdditionalMass(0,!1);for(let i=0;i<t.numColliders();i++)t.collider(i).setDensity(1);t.recomputeMassPropertiesFromColliders()}else{t.setAdditionalMass(e.mass,!1);for(let i=0;i<t.numColliders();i++)t.collider(i).setDensity(1e-7);t.recomputeMassPropertiesFromColliders()}t.setEnabledRotations(!e.lockRotationX,!e.lockRotationY,!e.lockRotationZ,!1),t.setEnabledTranslations(!e.lockPositionX,!e.lockPositionY,!e.lockPositionZ,!1),e.isKinematic?t.setBodyType(T.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicPositionBased,!1):t.setBodyType(T.RAPIER_PHYSICS.MODULE.RigidBodyType.Dynamic,!1)}lines;disabledLines;step(e){if(this.world&&this.enabled){if(this._isUpdatingPhysicsWorld=!0,this.eventQueue||(this.eventQueue=new T.RAPIER_PHYSICS.MODULE.EventQueue(!1)),e===void 0||e<=0){this._isUpdatingPhysicsWorld=!1;return}else if(e!==void 0){const t=D.lerp(this.world.timestep,e,.8);this.world.timestep=t}try{this.world.step(this.eventQueue)}catch(t){console.warn("Error running physics step",{timestep:this.world.timestep},t)}this._isUpdatingPhysicsWorld=!1}}postStep(){this.world&&this.enabled&&(this._isUpdatingPhysicsWorld=!0,this.syncObjects(),this._isUpdatingPhysicsWorld=!1,this.eventQueue&&!this.collisionHandler&&(this.collisionHandler=new Dj(this.world,this.eventQueue)),this.collisionHandler&&(this.collisionHandler.handleCollisionEvents(),this.collisionHandler.update()),this.updateDebugRendering(this.world))}updateDebugRendering(e){if(Ne||yb||jj||this.debugRenderColliders===!0){if(!this.lines){const n=new Bd({color:7855479,fog:!1}),s=new Yi;this.lines=new Fm(s,n),this.lines.layers.disableAll(),this.lines.layers.enable(2)}if(!this.disabledLines){const n=new Bd({color:14514039,fog:!1}),s=new Yi;this.disabledLines=new Fm(s,n),this.disabledLines.layers.disableAll(),this.disabledLines.layers.enable(2)}this.lines.parent!==this.context?.scene&&this.context?.scene.add(this.lines),this.disabledLines.parent!==this.context?.scene&&this.context?.scene.add(this.disabledLines);const t=e.debugRender(void 0,n=>n.isEnabled());this.lines.geometry.setAttribute("position",new tt(t.vertices,3)),this.lines.geometry.setAttribute("color",new tt(t.colors,4));const i=e.debugRender(void 0,n=>!n.isEnabled());this.disabledLines.geometry.setAttribute("position",new tt(i.vertices,3)),this.disabledLines.geometry.setAttribute("color",new tt(i.colors,4)),this.disabledLines.visible=i.vertices.length>0,(this.context.time.frame%30===0||this.lines.geometry.boundingSphere?.radius===0)&&(this.lines.geometry.computeBoundingSphere(),this.disabledLines.geometry.computeBoundingSphere())}else this.lines&&this.context?.scene.remove(this.lines),this.disabledLines&&this.context?.scene.remove(this.disabledLines)}syncObjects(){if(!yb)for(let e=0;e<this.bodies.length;e++){const t=this.objects[e],i=this.bodies[e],n=t;if(n?.isCollider===!0&&!n.attachedRigidbody){const l=i.parent();l?this.syncPhysicsBody(t.gameObject,l,!0,!0):this.syncPhysicsBody(t.gameObject,i,!0,!0);continue}const s=i.translation(),r=i.rotation();if(Number.isNaN(s.x)||Number.isNaN(r.x)){!n.__COLLIDER_NAN&&A()&&(console.warn("Collider has NaN values",n.name,n.gameObject,i),n.__COLLIDER_NAN=!0);continue}const a=t.center;if(a&&a.isVector3){this._tempQuaternion.set(r.x,r.y,r.z,r.w);const l=this._tempPosition.copy(a).applyQuaternion(this._tempQuaternion),c=Ge(t.gameObject);l.multiply(c),s.x-=l.x,s.y-=l.y,s.z-=l.z}Or(t.gameObject,s.x,s.y,s.z),bg(t.gameObject,r.x,r.y,r.z,r.w)}}syncPhysicsBody(e,t,i,n){if(t instanceof T.RAPIER_PHYSICS.MODULE.RigidBody){const s=ee(e,this._tempPosition),r=_e(e,this._tempQuaternion);switch(t.bodyType()){case T.RAPIER_PHYSICS.MODULE.RigidBodyType.Fixed:case T.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicPositionBased:case T.RAPIER_PHYSICS.MODULE.RigidBodyType.KinematicVelocityBased:i&&t.setNextKinematicTranslation(s),n&&t.setNextKinematicRotation(r);break;default:i&&t.setTranslation(s,!1),n&&t.setRotation(r,!1);break}}else if(t instanceof T.RAPIER_PHYSICS.MODULE.Collider){e.matrixWorldNeedsUpdate&&e.updateWorldMatrix(!0,!1),e.matrixWorld.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const s=this._tempPosition,r=this._tempQuaternion,a=t[Oi];if(this.tryApplyCenter(a,s),i){const l=t.translation();(l.x!==s.x||l.y!==s.y||l.z!==s.z)&&t.setTranslation(s)}if(n){const l=t.rotation();(l.x!==r.x||l.y!==r.y||l.z!==r.z||l.w!==r.w)&&t.setRotation(r)}}}_tempCenterPos=new b;_tempCenterVec=new b;_tempCenterQuaternion=new N;tryApplyCenter(e,t){const i=e.center;i&&e.gameObject&&(i.x!==0||i.y!==0||i.z!==0)&&(this._tempCenterPos.x=i.x,this._tempCenterPos.y=i.y,this._tempCenterPos.z=i.z,Ge(e.gameObject,this._tempCenterVec),this._tempCenterPos.multiply(this._tempCenterVec),e.attachedRigidbody?this._tempCenterPos.applyQuaternion(e.gameObject.quaternion):(_e(e.gameObject,this._tempCenterQuaternion),this._tempCenterPos.applyQuaternion(this._tempCenterQuaternion)),t.x+=this._tempCenterPos.x,t.y+=this._tempCenterPos.y,t.z+=this._tempCenterPos.z)}static _matricesBuffer=[];getRigidbodyRelativeMatrix(e,t,i,n){if(n===void 0&&(n=dc._matricesBuffer,n.length=0),e===t){const s=Ge(e,this._tempPosition);i.makeScale(s.x,s.y,s.z);for(let r=n.length-1;r>=0;r--)i.multiply(n[r]);return i}return n.push(e.matrix),e.parent&&this.getRigidbodyRelativeMatrix(e.parent,t,i,n),i}static centerConnectionPos={x:0,y:0,z:0};static centerConnectionRot={x:0,y:0,z:0,w:1};addFixedJoint(e,t){if(!this.world){console.error("Physics world not initialized");return}const i=e[jt],n=t[jt];this.calculateJointRelativeMatrices(e.gameObject,t.gameObject,this._tempMatrix),this._tempMatrix.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const s=T.RAPIER_PHYSICS.MODULE.JointData.fixed(dc.centerConnectionPos,dc.centerConnectionRot,this._tempPosition,this._tempQuaternion),r=this.world.createImpulseJoint(s,i,n,!0);Ne&&console.log("ADD FIXED JOINT",r)}addHingeJoint(e,t,i,n){if(!this.world){console.error("Physics world not initialized");return}const s=e[jt],r=t[jt];this.calculateJointRelativeMatrices(e.gameObject,t.gameObject,this._tempMatrix),this._tempMatrix.decompose(this._tempPosition,this._tempQuaternion,this._tempScale);const a=T.RAPIER_PHYSICS.MODULE.JointData.revolute(i,this._tempPosition,n),l=this.world.createImpulseJoint(a,s,r,!0);Ne&&console.log("ADD HINGE JOINT",l)}calculateJointRelativeMatrices(e,t,i){e.updateWorldMatrix(!0,!1),t.updateWorldMatrix(!0,!1);const n=e.matrixWorld,s=t.matrixWorld;n.elements[0]=1,n.elements[5]=1,n.elements[10]=1,s.elements[0]=1,s.elements[5]=1,s.elements[10]=1,i.copy(s).premultiply(n.invert()).invert()}}class Dj{world;eventQueue;constructor(e,t){this.world=e,this.eventQueue=t}activeCollisions=[];activeCollisionsStay=[];activeTriggers=[];handleCollisionEvents(){this.eventQueue&&this.world&&this.eventQueue.drainCollisionEvents((e,t,i)=>{const n=this.world.getCollider(e),s=this.world.getCollider(t);if(!n||!s)return;const r=n[Oi],a=s[Oi];bb&&console.log("EVT",r.name,a.name,i,n,s),r&&a&&(i?(this.onCollisionStarted(r,n,a,s),this.onCollisionStarted(a,s,r,n)):(this.onCollisionEnded(r,a),this.onCollisionEnded(a,r)))})}update(){this.onHandleCollisionStay()}onCollisionStarted(e,t,i,n){let s=null;if(e.isTrigger||i.isTrigger)Wr(e.gameObject,r=>{r.onTriggerEnter&&!r.destroyed&&r.onTriggerEnter(i),this.activeTriggers.push({collider:e,component:r,otherCollider:i})});else{const r=e.gameObject;this.world.contactPair(t,n,(a,l)=>{Wr(r,c=>{if(c.destroyed)return;const h=c.onCollisionEnter||c.onCollisionStay||c.onCollisionExit;if(h||bb){if(!s){const d=[],p=a.normal();i instanceof Ns&&i.convex&&(p.x=-p.x,p.y=-p.y,p.z=-p.z);for(let m=0;m<a.numSolverContacts();m++){const f=a.solverContactPoint(m),g=a.contactImpulse(m);if(f){const y=a.contactDist(m),_=a.solverContactFriction(m),v=a.solverContactTangentVelocity(m),P=new iv(f,y,p,g,_,v);d.push(P),bb&&B.DrawDirection(f,p,16711680,3,!0)}}s=new nv(r,i,d)}if(h){const d={collider:e,component:c,collision:s};this.activeCollisions.push(d),c.onCollisionStay&&this.activeCollisionsStay.push(d),c.onCollisionEnter?.call(c,s)}}})})}}onHandleCollisionStay(){for(const e of this.activeCollisionsStay){const t=e.component;if(!t.destroyed&&t.activeAndEnabled&&t.onCollisionStay){if(e.collision.collider.destroyed)continue;const i=e.collision;t.onCollisionStay(i)}}for(const e of this.activeTriggers){const t=e.component;if(!t.destroyed&&t.activeAndEnabled&&t.onTriggerStay){const i=e.otherCollider;if(i.destroyed)continue;t.onTriggerStay(i)}}}onCollisionEnded(e,t){if(!(e.destroyed||t.destroyed)){for(let i=0;i<this.activeCollisions.length;i++){const n=this.activeCollisions[i],s=n.collider;if(s.destroyed||n.collision.collider.destroyed){this.activeCollisions.splice(i,1),i--;continue}if(s===e&&n.collision.collider===t){const r=n.component;if(this.activeCollisions.splice(i,1),i--,r.activeAndEnabled&&r.onCollisionExit){const a=n.collision;r.onCollisionExit(a)}}}for(let i=0;i<this.activeCollisionsStay.length;i++){const n=this.activeCollisionsStay[i],s=n.collider;if(s.destroyed||n.collision.collider.destroyed){this.activeCollisionsStay.splice(i,1),i--;continue}if(s===e&&n.collision.collider===t){const r=n.component;if(this.activeCollisionsStay.splice(i,1),i--,r.activeAndEnabled&&r.onCollisionExit){const a=n.collision;r.onCollisionExit(a)}}}for(let i=0;i<this.activeTriggers.length;i++){const n=this.activeTriggers[i],s=n.collider;if(s.destroyed||n.otherCollider.destroyed){this.activeTriggers.splice(i,1),i--;continue}if(s===e&&n.otherCollider===t){const r=n.component;if(this.activeTriggers.splice(i,1),i--,r.activeAndEnabled&&r.onTriggerExit){const a=n.otherCollider;r.onTriggerExit(a)}}}}}}let _b=0;function YS(o){o?_b++:_b--}function Bj(){return _b>0}const Fj={binary:!0,animations:!0};async function Uj(o){if(!o.context)throw new Error("No context provided to exportAsGLTF");o.scene||(o.scene=o.context.scene);const e={...Fj,...o},{context:t}=e,i=new Xb;i.register(a=>new g1(a)),i.register(a=>new OA(a)),i.register(a=>new y1(a)),Oy(i,e.context);const n={binary:e.binary,animations:Nj(t,e.scene,[])},s=new zj;console.debug("Exporting GLTF",n),s.onBeforeExport(e),YS(!0);const r=await i.parseAsync(e.scene,n).catch(a=>(console.error(a),null));if(YS(!1),s.onAfterExport(e),!r)throw new Error("Failed to export GLTF");if(e.downloadAs!=null){let a=null;if(r instanceof ArrayBuffer?a=new Blob([r],{type:"application/octet-stream"}):console.error("Can not download GLTF as a blob",r),a){const l=URL.createObjectURL(a),c=document.createElement("a");c.href=l;let h=e.downloadAs;!h.endsWith(".glb")&&!h.endsWith(".gltf")&&(h+=e.binary?".glb":".gltf"),c.download=h,c.click()}}return r}const ZS=Symbol("needle:weight");class zj{_undo=[];onBeforeExport(e){e.context.animations.mixers.forEach(t=>{const i=Kn.tryGetActionsFromMixer(t);if(i)for(let n=0;n<i.length;n++){const s=i[n];s[ZS]=s.weight,s.weight=0,this._undo.push(()=>{s.weight=s[ZS]})}t.update(0)}),e.context.scene.traverse(t=>{if(!Iy(t)){const i=t.parent;i&&(t.removeFromParent(),this._undo.push(()=>i.add(t)))}})}onAfterExport(e){this._undo.forEach(t=>t()),this._undo.length=0}}function Nj(o,e,t){o.animations.mixers.forEach(n=>{const s=Kn.tryGetActionsFromMixer(n);if(s)for(let r=0;r<s.length;r++){const a=s[r].getClip();t.push(a)}}),Array.isArray(e)||(e=[e]);for(const n of e)Kn.tryGetAnimationClipsFromObjectHierarchy(n,t);const i=new Set(t);return Array.from(i)}const yd=w("debugavatar");class vb{root;head;leftHand;rigthHand;get isValid(){return this.head!==null&&this.head!==void 0}constructor(e,t,i,n){this.root=e,this.head=t,this.leftHand=i,this.rigthHand=n,this.root?.traverse(s=>s.layers.set(2))}}class KS{avatarRegistryUrl=null;async getOrCreateNewAvatarInstance(e,t){if(!t)return console.error("Can not create avatar: failed to provide id or root object"),null;let i=null;if(typeof t=="string"){if(i=await this.loadAvatar(e,t),!i){const s=new Gn;i=S.instantiate(za(t,e.scene),s)}}else i=t;if(!i)return null;const n=this.findAvatar(i);return n.isValid?(yd&&console.log("[Custom Avatar] valid config",t,yd?n:""),n):(console.warn("[Custom Avatar] config isn't valid",t,yd?n:""),null)}async loadAvatar(e,t){if(console.assert(t!=null&&typeof t=="string","Avatar id must not be null"),t.length<=0||!t)return null;if(yd&&console.log("[Custom Avatar] "+t+", loading..."),t.endsWith(".glb")||(t+=".glb"),this.avatarRegistryUrl===null){const n=await fetch("./"+t);let s=null;if(n.ok){const r=await n.blob();r&&(s=await r.arrayBuffer())}return s?(await kn().parseSync(e,s,null,0))?.scene??null:null}const i=new Do;return n0(i,e),new Promise((n,s)=>{const r=this.avatarRegistryUrl+"/"+t;i.load(r,async a=>{await kn().createBuiltinComponents(e,r,a,null,void 0),n(a.scene)},a=>{yd&&console.log("[Custom Avatar] "+a.loaded/a.total*100+"% loaded of "+a.total/1024+"kB")},a=>{console.error("[Custom Avatar] Error when loading: "+a),n(null)})})}cacheModel(e,t){}findAvatar(e){const t=e;let i=t;i.children.length==1&&(i=e.children[0]);let n=this.findAvatarPart(i,["head"]);const s=this.findAvatarPart(i,["left","hand"]),r=this.findAvatarPart(i,["right","hand"]);if(!n){n=t;const a=new b;new Nt().setFromObject(n).getSize(a);const l=Math.max(a.x,a.y,a.z);console.warn("[Custom Avatar] Normalizing head scale, it's too big: "+l+" meters! Should be < 0.3m"),l>.3&&n.scale.multiplyScalar(1/l*.3)}return new vb(t,n,s,r)}findAvatarPart(e,t){const i=e.name.toLowerCase();let n=!0;for(const s of t){if(!n)break;i.indexOf(s)===-1&&(n=!1)}if(n)return e;if(e.children)for(const s of e.children){const r=this.findAvatarPart(s,t);if(r)return r}return null}handleCustomAvatarErrors(e){if(!e.ok)throw Error(e.statusText);return e}}class JS{get extensionName(){return"DocumentExtension"}onAfterBuildDocument(e){}}class eC{}const Wj=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:fe,ActionCollection:z1,ActionModel:ki,AlignmentConstraint:uh,Animation:Vt,AnimationCurve:jh,AnimationExtension:Ap,AnimationTrackHandler:ah,Animator:vt,AnimatorController:bn,Antialiasing:zh,Attractor:Gl,AudioExtension:Ma,AudioListener:Go,AudioSource:Ui,AudioTrackHandler:_s,Avatar:Gs,AvatarBlink_Simple:Yr,AvatarEyeLook_Rotation:ay,AvatarLoader:KS,AvatarMarker:Le,AvatarModel:vb,Avatar_Brain_LookAt:ph,Avatar_MouthShapes:mh,Avatar_MustacheShake:sy,Avatar_POI:Qr,AxesHelper:fl,BaseUIComponent:gn,BasicIKConstraint:cy,BehaviorExtension:s0,BehaviorModel:Ft,BloomEffect:om,BoxCollider:lp,BoxGizmo:la,BoxHelperComponent:zt,Button:cs,CallInfo:Ho,Camera:_i,CameraTargetReachedEvent:oh,Canvas:Fl,CanvasGroup:Ks,CapsuleCollider:qo,ChangeMaterialOnClick:qy,ChangeTransformOnClick:oa,CharacterController:Zr,CharacterControllerInput:Qo,ChromaticAberration:Nh,ClickThrough:bm,ColorAdjustments:sr,ColorBySpeedModule:$l,ColorOverLifetimeModule:Zp,ContactShadows:fh,ControlTrackHandler:ep,CursorFollow:xa,CustomBranding:aa,Deletable:my,DeleteBox:br,DepthOfField:Nn,DeviceFlag:cp,DocumentExtension:JS,DragControls:Jr,DropListener:Jo,Duplicatable:Ry,EffectWrapper:Vh,EmissionModule:rs,EmphasizeOnClick:Rl,EnvironmentScene:tp,EventList:oe,EventListEvent:Vu,EventSystem:ci,EventTrigger:xp,FieldWithDefault:m1,FixedJoint:S0,Fog:Ul,GltfExport:Dy,GltfExportBox:Ly,Gradient:ha,Graphic:Th,GraphicRaycaster:Xu,GridHelper:zl,GridLayoutGroup:m0,GroundProjectedEnv:so,GroupActionModel:na,HideOnStart:_n,HingeJoint:Lh,HorizontalLayoutGroup:p0,get HoverAnimation(){return Po},Image:Yl,InheritVelocityModule:R0,InputField:tb,InstanceHandle:Ia,InstancingHandler:Ea,Interactable:py,Keyframe:Si,LODGroup:$p,LODModel:Wl,Light:It,LimitVelocityOverLifetimeModule:pt,LogStats:uy,LookAt:ib,LookAtConstraint:Hr,MainModule:Qt,MarkerTrackHandler:Ju,MaskableGraphic:Ah,MeshCollider:Ns,MeshRenderer:_h,MinMaxCurve:Y,MinMaxGradient:da,NeedleMenu:_o,NestedGltf:Vl,Networking:k0,NoiseModule:ve,ObjectRaycaster:nn,OffsetConstraint:ca,OpenURL:Zl,OrbitControls:me,Outline:Dl,Padding:ra,ParticleBurst:Yp,ParticleSubEmitter:T0,ParticleSystem:Fh,ParticleSystemRenderer:dn,PhysicsExtension:r0,PixelationEffect:$h,PlayAnimationOnClick:xh,PlayAudioOnClick:Hs,PlayableDirector:ml,PlayerColor:lc,PointerEventData:Cd,PostProcessingHandler:cc,PreliminaryAction:Tl,PreliminaryTrigger:Sh,RawImage:gm,Rect:Z1,RectTransform:Un,ReflectionProbe:Zo,RegisteredAnimationInfo:_r,RemoteSkybox:sp,Renderer:ni,RendererLightmap:ky,Rigidbody:Je,RotationBySpeedModule:hn,RotationOverLifetimeModule:zn,SceneSwitcher:et,ScreenCapture:rr,ScreenSpaceAmbientOcclusion:as,ScreenSpaceAmbientOcclusionN8:Wn,ScrollFollow:hs,SeeThrough:ls,SetActiveOnClick:Xy,ShadowCatcher:Yh,ShapeModule:E0,SharpeningEffect:Gh,SignalAsset:Ku,SignalReceiver:rh,SignalReceiverEvent:sh,SignalTrackHandler:lh,Size:Y1,SizeBySpeedModule:Ci,SizeOverLifetimeModule:ua,SkinnedMeshRenderer:My,SmoothFollow:cm,SpatialGrabRaycaster:ka,SpatialHtml:td,SpatialTrigger:hm,SpatialTriggerReceiver:So,SpectatorCamera:dm,SphereCollider:yl,SplineContainer:_a,SplineData:Co,SplineWalker:pn,Sprite:ts,SpriteData:Il,SpriteRenderer:wi,SpriteSheet:Al,SubEmitterSystem:tm,SyncedCamera:Q0,SyncedRoom:Vn,SyncedTransform:Ln,TapGestureTrigger:Yy,TeleportTarget:Fp,TestRunner:K0,TestSimulateUserData:J0,Text:Xt,TextBuilder:d0,TextExtension:Wp,TextureSheetAnimationModule:Yt,TiltShiftEffect:xo,ToneMappingEffect:or,TrailModule:Ue,TransformData:Ve,TransformGizmo:va,TriggerBuilder:qt,TriggerModel:mr,UIRaycastUtils:Hf,UIRootComponent:Mh,USDZExporter:wo,USDZText:Bl,USDZUIExtension:y0,UsageMarker:yh,VariantAction:Hy,VelocityOverLifetimeModule:Xe,VerticalLayoutGroup:u0,VideoPlayer:gt,get ViewBox(){return at},Vignette:fa,VisibilityAction:Ch,Voip:zs,Volume:ba,VolumeParameter:U,VolumeProfile:im,WebARCameraBackground:rd,WebARSessionRoot:vn,WebXR:Up,WebXRImageTracking:ad,WebXRImageTrackingModel:us,WebXRPlaneTracking:ps,WebXRTrackedImage:hc,XRControllerFollow:ds,XRControllerModel:is,XRControllerMovement:Wi,XRFlag:sn,XRRig:xm,XRState:li,__Ignore:eC},Symbol.toStringTag,{value:"Module"}));var wb;(o=>{function e(t,i=!1,n=.75){const s=new _a,r=1-D.clamp(n,0,1);return t.forEach((a,l)=>{const c=new b;l<t.length-1?c.subVectors(t[l+1],a).normalize().multiplyScalar(r):i&&t.length>1&&c.subVectors(t[0],a).normalize().multiplyScalar(r);const h=new Co;h.position.copy(a),h.tangentIn.copy(c),h.tangentOut.copy(c),s.addKnot(h)}),s.closed=i,s}o.createFromPoints=e})(wb||(wb={}));class Vj extends rO{constructor(){super(new Worker(URL.createObjectURL(new Blob([`import '${new URL("./generateMeshBVH.worker-DiCnZlf3.js",import.meta.url).toString()}';`],{type:"text/javascript"})),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(e,t,i={}){return new Promise((n,s)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=c=>{s(new Error(`[GenerateMeshBVHWorker] ${c.message||"Could not load worker."}`))},e.onmessage=c=>{const{data:h}=c;if(h.error)s(new Error(h.error)),e.onmessage=null;else if(h.serialized){const{serialized:d,position:p}=h,m=aO.deserialize(d,t,{setIndex:!1}),f=Object.assign({setBoundingBox:!0},i);if(t.attributes.position.array=p,d.index)if(t.index)t.index.array=d.index;else{const g=new tt(d.index,1,!1);t.setIndex(g)}f.setBoundingBox&&(t.boundingBox=m.getBoundingBox(new Nt)),i.onProgress&&i.onProgress(h.progress),n(m),e.onmessage=null}else i.onProgress&&i.onProgress(h.progress)};const r=t.index?t.index.array:null,a=t.attributes.position.array,l=[a];r&&l.push(r),e.postMessage({index:r,position:a,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...t.groups]}},l.map(c=>c.buffer).filter(c=>typeof SharedArrayBuffer>"u"||!(c instanceof SharedArrayBuffer)))})}}const $j=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:Vj},Symbol.toStringTag,{value:"Module"}));export{tv as $componentName,Hk as $physicsKey,fe as ActionBuilder,z1 as ActionCollection,ki as ActionModel,Ev as Addressables,uh as AlignmentConstraint,Ka as AmbientMode,Vt as Animation,jh as AnimationCurve,Ap as AnimationExtension,ah as AnimationTrackHandler,Kn as AnimationUtils,vt as Animator,As as AnimatorConditionMode,bn as AnimatorController,Uf as AnimatorControllerParameterType,Qc as AnimatorStateInfo,zh as Antialiasing,Hn as Application,Dw as AssetDatabase,ne as AssetReference,Gl as Attractor,Nf as AudioClip,Ma as AudioExtension,Go as AudioListener,Ui as AudioSource,_s as AudioTrackHandler,Gs as Avatar,Yr as AvatarBlink_Simple,ay as AvatarEyeLook_Rotation,KS as AvatarLoader,Le as AvatarMarker,vb as AvatarModel,ph as Avatar_Brain_LookAt,mh as Avatar_MouthShapes,sy as Avatar_MustacheShake,Qr as Avatar_POI,dl as Axes,fl as AxesHelper,Sc as BUILD_TIME,gn as BaseUIComponent,cy as BasicIKConstraint,s0 as BehaviorExtension,Ft as BehaviorModel,Ar as BlobStorage,om as BloomEffect,lp as BoxCollider,la as BoxGizmo,zt as BoxHelperComponent,cs as Button,fn as ButtonsFactory,zx as CallDirection,Ho as CallInfo,_i as Camera,oh as CameraTargetReachedEvent,Fl as Canvas,Ks as CanvasGroup,qo as CapsuleCollider,qy as ChangeMaterialOnClick,oa as ChangeTransformOnClick,Zr as CharacterController,Qo as CharacterControllerInput,Nh as ChromaticAberration,Ii as CircularBuffer,qr as ClearFlags,bm as ClickThrough,ao as ClipExtrapolation,rn as Collider,nv as Collision,Gu as CollisionDetectionMode,sr as ColorAdjustments,$l as ColorBySpeedModule,Zp as ColorOverLifetimeModule,tR as Component,E as Component$1,Cu as ComponentLifecycleEvents,Wj as Components,Hv as ConnectionEvents,iv as ContactPoint,fh as ContactShadows,z as Context,fE as ContextArgs,ue as ContextEvent,pe as ContextRegistry,ep as ControlTrackHandler,xa as CursorFollow,aa as CustomBranding,Te as CustomShader,_u as DefaultReflectionMode,my as Deletable,br as DeleteBox,Nn as DepthOfField,cp as DeviceFlag,I as DeviceUtilities,JS as DocumentExtension,Jr as DragControls,fy as DragMode,Jo as DropListener,Ry as Duplicatable,Vh as EffectWrapper,rs as EmissionModule,Rl as EmphasizeOnClick,kd as EngineLoadingView,tp as EnvironmentScene,oe as EventList,Vu as EventListEvent,ci as EventSystem,xp as EventTrigger,m1 as FieldWithDefault,Aa as FileReference,Tv as FileReferenceSerializer,VT as FileSpawnModel,Yx as File_Event,S0 as FixedJoint,Ul as Fog,xe as FrameEvent,Ha as GENERATOR,S as GameObject,B as Gizmos,Dy as GltfExport,Ly as GltfExportBox,ha as Gradient,Th as Graphic,Xu as GraphicRaycaster,fr as Graphics,zl as GridHelper,m0 as GridLayoutGroup,so as GroundProjectedEnv,na as GroupActionModel,iu as HideFlags,_n as HideOnStart,Lh as HingeJoint,p0 as HorizontalLayoutGroup,HE as HostData,Po as HoverAnimation,Yl as Image,Ta as ImageReference,Rv as ImageReferenceSerializer,R0 as InheritVelocityModule,Dv as Input,fi as InputEventQueue,Ie as InputEvents,tb as InputField,Ia as InstanceHandle,Ea as InstancingHandler,yn as InstancingUtil,Kw as InstantiateEvent,Ut as InstantiateIdProvider,Gn as InstantiateOptions,py as Interactable,sd as InternalScreenshotUtils,LM as JoinedRoomResponse,OM as KeyEventArgs,Si as Keyframe,$p as LODGroup,Wl as LODModel,jM as LeftRoomResponse,It as Light,Jv as LightData,pt as LimitVelocityOverLifetimeModule,kj as LoadingElementOptions,uy as LogStats,Li as LogType,ib as LookAt,Hr as LookAtConstraint,T as MODULES,Qt as MainModule,Ju as MarkerTrackHandler,Yf as MarkerType,Ah as MaskableGraphic,ys as MaterialPropertyBlock,fp as MaterialX,D as Mathf,Ns as MeshCollider,_h as MeshRenderer,Y as MinMaxCurve,da as MinMaxGradient,Rg as NEEDLE_ENGINE_FEATURE_FLAGS,Rc as NEKeyboardEvent,No as NEPointerEvent,VS as NeedleButtonElement,by as NeedleEngineModelLoader,fb as NeedleEngineWebComponent,_o as NeedleMenu,tu as NeedlePatchesKey,xf as NeedleXRController,Z as NeedleXRSession,Ow as NeedleXRSync,Rw as NeedleXRUtils,Vl as NestedGltf,qv as NetworkConnection,co as NetworkedStreamEvents,Pd as NetworkedStreams,k0 as Networking,ex as NewInstanceModel,ve as NoiseModule,nn as ObjectRaycaster,Rs as ObjectUtils,ca as OffsetConstraint,Gd as OneEuroFilter,ug as OneEuroFilterXYZ,Zl as OpenURL,me as OrbitControls,Dl as Outline,Gv as OwnershipEvent,cf as OwnershipModel,Os as PUBLIC_KEY,ra as Padding,Yp as ParticleBurst,T0 as ParticleSubEmitter,Fh as ParticleSystem,nr as ParticleSystemBaseBehaviour,dn as ParticleSystemRenderer,Qp as ParticleSystemShapeType,vs as PeerHandle,Vv as PeerNetworking,rc as Physics,r0 as PhysicsExtension,wt as PhysicsMaterialCombine,$h as PixelationEffect,xh as PlayAnimationOnClick,Hs as PlayAudioOnClick,ml as PlayableDirector,lc as PlayerColor,ln as PlayerState,$1 as PlayerStateEvent,Jy as PlayerSync,Xv as PlayerView,Qv as PlayerViewManager,Cd as PointerEventData,mu as PointerType,st as PostProcessingEffect,mt as PostProcessingEffectOrder,cc as PostProcessingHandler,Tl as PreliminaryAction,Sh as PreliminaryTrigger,Ws as PreviewHelper,Qa as PrimitiveType,le as Progress,sg as PromiseAllWithErrors,og as PromiseErrorResult,re as RGBAColor,dc as RapierPhysics,gm as RawImage,Ts as RaycastOptions,Z1 as Rect,Un as RectTransform,Zo as ReflectionProbe,_r as RegisteredAnimationInfo,sp as RemoteSkybox,Eo as RenderTexture,gx as RenderTextureSerializer,ni as Renderer,Kv as RendererData,ky as RendererLightmap,Je as Rigidbody,Ke as RigidbodyConstraints,ie as RoomEvents,hn as RotationBySpeedModule,zn as RotationOverLifetimeModule,gp as SceneLightSettings,et as SceneSwitcher,rr as ScreenCapture,as as ScreenSpaceAmbientOcclusion,Wn as ScreenSpaceAmbientOcclusionN8,hs as ScrollFollow,ls as SeeThrough,En as SendQueue,Yg as SerializationContext,Xy as SetActiveOnClick,Yh as ShadowCatcher,E0 as ShapeModule,ov as ShapeOverlapResult,Gh as SharpeningEffect,Ku as SignalAsset,rh as SignalReceiver,sh as SignalReceiverEvent,lh as SignalTrackHandler,Y1 as Size,Ci as SizeBySpeedModule,ua as SizeOverLifetimeModule,My as SkinnedMeshRenderer,cm as SmoothFollow,ka as SpatialGrabRaycaster,td as SpatialHtml,hm as SpatialTrigger,So as SpatialTriggerReceiver,dm as SpectatorCamera,yl as SphereCollider,Tf as SphereIntersection,_a as SplineContainer,Co as SplineData,wb as SplineUtils,pn as SplineWalker,ts as Sprite,Il as SpriteData,wi as SpriteRenderer,Al as SpriteSheet,XE as StateMachineBehaviour,ny as StreamEndedEvent,Ux as StreamReceivedEvent,tm as SubEmitterSystem,Q0 as SyncedCamera,Vn as SyncedRoom,Ln as SyncedTransform,Yy as TapGestureTrigger,Fp as TeleportTarget,K0 as TestRunner,J0 as TestSimulateUserData,Xt as Text,d0 as TextBuilder,Wp as TextExtension,Yt as TextureSheetAnimationModule,xo as TiltShiftEffect,tw as Time,or as ToneMappingEffect,pl as TrackHandler,zi as TrackType,Ue as TrailModule,Ve as TransformData,va as TransformGizmo,qt as TriggerBuilder,mr as TriggerModel,C as TypeStore,Hf as UIRaycastUtils,Mh as UIRootComponent,By as USDDocument,lt as USDObject,S1 as USDWriter,P1 as USDZExporter,wo as USDZExporter$1,Bl as USDZText,y0 as USDZUIExtension,fx as UriSerializer,yh as UsageMarker,DM as UserJoinedOrLeftRoomModel,mi as VERSION,Hy as VariantAction,Xe as VelocityOverLifetimeModule,u0 as VerticalLayoutGroup,gt as VideoPlayer,at as ViewBox,Wo as ViewDevice,fa as Vignette,Ch as VisibilityAction,zs as Voip,ba as Volume,U as VolumeParameter,im as VolumeProfile,xM as WaitForFrames,Iv as WaitForPromise,tf as WaitForSeconds,fs as Watch,rd as WebARCameraBackground,vn as WebARSessionRoot,Up as WebXR,gr as WebXRButtonFactory,ad as WebXRImageTracking,us as WebXRImageTrackingModel,ps as WebXRPlaneTracking,hc as WebXRTrackedImage,ds as XRControllerFollow,is as XRControllerModel,Wi as XRControllerMovement,sn as XRFlag,xm as XRRig,li as XRState,uo as XRStateFlag,eC as __Ignore,BE as __internalNotifyObjectDestroyed,Jn as activeInHierarchyFieldName,ig as addAttributeChangeCallback,Tn as addComponent,pA as addCustomExtensionPlugin,jr as addNewComponent,eu as addPatch,Pu as apply,eR as applyHMRChanges,mw as applyPrototypeExtensions,Jw as beginListenDestroy,ix as beginListenInstantiate,rf as binaryIdentifierCasts,gE as build_scene_functions,Tr as builtinComponentKeyName,gb as calculateProgress01,FO as clearMessages,yx as colorSerializer,xv as compareAssociation,Kc as componentSerializer,B_ as copyTexture,rx as createMotion,yi as debugNet,Ac as debugOwner,R1 as decompressGpuTexture,fc as deepClone,Fo as delay,Wd as delayForFrames,uu as deserializeObject,Bi as destroy,bw as destroyComponentInstance,Zx as determineMimeTypeFromExtension,Me as disposeObjectResources,ho as disposeStream,Cc as editorGuidKeyName,$a as enableSpatialConsole,bx as eventListSerializer,Uj as exportAsGLTF,Lf as findByGuid,nl as findObjectOfType,ww as findObjectsOfType,Af as findResourceUsers,Sx as fitCamera,U_ as fitObjectIntoVolume,Wr as foreachComponent,Fu as foreachComponentEnumerator,nk as forward,lw as generateQRCode,tx as generateSeed,ui as getBoundingBox,C_ as getCameraController,Dr as getComponent,Fc as getComponentInChildren,Uc as getComponentInParent,Bc as getComponents,il as getComponentsInChildren,Ou as getComponentsInParent,_1 as getFormattedDate,kt as getIconElement,gf as getIconTexture,kn as getLoader,Dc as getOrAddComponent,w as getParam,rk as getParentHierarchyPath,fO as getPath,RM as getPeerOptions,Nv as getPeerjsInstance,UE as getResourceUserCount,M_ as getTempColor,di as getTempQuaternion,F as getTempVector,mc as getUrlParams,F_ as getVisibleInCustomShadowRendering,A_ as getWorldDirection,_g as getWorldEuler,ee as getWorldPosition,_e as getWorldQuaternion,Yd as getWorldRotation,Ge as getWorldScale,io as hasCommercialLicense,kc as hasIndieLicense,qu as hasPointerEventComponent,to as hasProLicense,$_ as hideDebugConsole,T1 as imageToCanvas,Av as initAddressableSerializers,_x as initBuiltinSerializers,Lj as initEngine,Lx as initVolumeParameterSerializer,Vr as instantiate,c1 as invokeLoadedImportPluginHooks,rw as invokeXRSessionEnd,sw as invokeXRSessionStart,$w as isActiveInHierarchy,ll as isActiveSelf,xO as isAndroidDevice,D_ as isAnimationAction,Mg as isComponent,uO as isDebugMode,bO as isDesktop,Nr as isDestroyed,A as isDevEnvironment,DE as isDisposed,Bj as isExporting,ev as isGLTFModel,r_ as isHostedOnGlitch,zf as isHotReloadEnabled,KE as isHotReloading,vO as isIPad,cw as isIconElement,Ai as isLocalNetwork,CO as isMacOS,_O as isMobileDevice,SO as isMozillaXR,kO as isQuest,Fw as isResourceTrackingEnabled,OO as isSafari,ju as isUsingInstancing,PO as isiOS,wO as isiPad,_j as loadAsset,iy as loadPMREM,pb as loadSync,Zd as logHierarchy,QO as lookAtInverse,yc as lookAtObject,YO as lookAtScreenPoint,mO as makeId,d_ as makeIdFromRandomWords,Ni as makeNameSafe,Hw as markAsInstancedRendered,MO as microphonePermissionsGranted,dO as nameof,a_ as nameofFactory,Wf as objectSerializer,qM as offXRSessionEnd,GM as offXRSessionStart,eM as onAfterRender,Jk as onBeforeRender,Zk as onClear,Kk as onDestroy,zg as onInitialized,au as onStart,yv as onUpdate,pf as onXRSessionEnd,vu as onXRSessionStart,US as parseSync,z_ as placeOnSurface,xg as postprocessFBXMaterials,OR as prefix,l_ as pushState,gO as randomNumber,af as registerBinaryType,ku as registerComponent,Py as registerComponentExtension,un as registerCustomEffectType,Oy as registerExportExtensions,bp as registerExtensions,cx as registerHotReloadType,av as registerLoader,ox as registerPrefabProvider,_f as registerPrototypeExtensions,Pg as registerType,p_ as relativePathPrefix,ng as removeAttributeChangeCallback,vf as removeComponent,mA as removeCustomImportExtensionType,Wk as removePatch,Qn as resolveUrl,u_ as sanitizeString,IS as saveImage,JL as screenshot,lb as screenshot2,Bf as sendDestroyed,u as serializable,Ov as serializeObject,qe as serializeable,qc as setActive,y_ as setAllowBalloonMessages,LO as setAllowOverlayMessages,Xd as setAutoFitEnabled,pg as setCameraController,qw as setDestroyed,VO as setDevEnvironment,zw as setDisposable,cl as setDontDestroy,Jm as setOrAddParamsToUrl,pO as setParam,gc as setParamWithoutReload,TM as setPeerOptions,jE as setResourceTrackingEnabled,eg as setState,wg as setVisibleInCustomShadowRendering,vg as setWorldEuler,bt as setWorldPosition,Or as setWorldPositionXYZ,On as setWorldQuaternion,bg as setWorldQuaternionXYZW,j_ as setWorldRotation,bc as setWorldRotationXYZ,Va as setWorldScale,wc as showBalloonError,ke as showBalloonMessage,be as showBalloonWarning,Sg as showDebugConsole,O_ as slerp,Xc as syncDestroy,ty as syncField,Ff as syncInstantiate,ak as textureToCanvas,m_ as toSourceId,Uv as tryCastBinary,Jx as tryDetermineMimetypeFromBinary,Kx as tryDetermineMimetypeFromURL,za as tryFindObject,zv as tryGetGuid,hx as unregisterHotReloadType,tg as unwatchWrite,P_ as useForAutoFit,Mt as validate,$d as watchWrite};
|