@needle-tools/engine 3.37.1-alpha → 3.37.2-alpha

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/needle-engine.js +41 -40
  3. package/dist/needle-engine.light.js +41 -40
  4. package/dist/needle-engine.light.min.js +48 -47
  5. package/dist/needle-engine.light.umd.cjs +51 -50
  6. package/dist/needle-engine.min.js +48 -47
  7. package/dist/needle-engine.umd.cjs +51 -50
  8. package/lib/engine/engine_mainloop_utils.d.ts +5 -1
  9. package/lib/engine/engine_mainloop_utils.js +7 -3
  10. package/lib/engine/engine_mainloop_utils.js.map +1 -1
  11. package/lib/engine/webcomponents/api.d.ts +1 -0
  12. package/lib/engine/webcomponents/api.js +1 -0
  13. package/lib/engine/webcomponents/api.js.map +1 -1
  14. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +2 -2
  15. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  16. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.d.ts +5 -3
  17. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js +3 -4
  18. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js.map +1 -1
  19. package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js +1 -4
  20. package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js.map +1 -1
  21. package/lib/engine-components/webxr/WebXR.js +2 -2
  22. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/engine/engine_mainloop_utils.ts +7 -3
  25. package/src/engine/webcomponents/api.ts +1 -0
  26. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +3 -4
  27. package/src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts +8 -6
  28. package/src/engine-components/export/usdz/extensions/behavior/PhysicsExtension.ts +1 -5
  29. package/src/engine-components/webxr/WebXR.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@ 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
+ ## [3.37.2-alpha] - 2023-04-17
8
+ - Fix: Regression in USDZ export causing behaviours to stop working
9
+
7
10
  ## [3.37.1-alpha] - 2023-04-16
8
11
  - Fix: Eventlist now handles EventListeners being added or removed during `EventList.invoke`
9
12
  - Fix: Progressive LOD textures issue where compressed textures would not be loaded in some cases when using tiling
@@ -29476,13 +29476,13 @@ function JBA(g) {
29476
29476
  Ik = g;
29477
29477
  }
29478
29478
  const ET = IA("debugdefines");
29479
- YE('if(!globalThis[""3.37.1-alpha""]) globalThis[""3.37.1-alpha""] = "0.0.0";');
29479
+ YE('if(!globalThis[""3.37.2-alpha""]) globalThis[""3.37.2-alpha""] = "0.0.0";');
29480
29480
  YE('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
29481
- YE('if(!globalThis[""Tue Apr 16 2024 10:30:30 GMT+0200 (Central European Summer Time)""]) globalThis[""Tue Apr 16 2024 10:30:30 GMT+0200 (Central European Summer Time)""] = "unknown";');
29482
- YE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.1-alpha";');
29481
+ YE('if(!globalThis[""Wed Apr 17 2024 08:57:30 GMT+0200 (Central European Summer Time)""]) globalThis[""Wed Apr 17 2024 08:57:30 GMT+0200 (Central European Summer Time)""] = "unknown";');
29482
+ YE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.2-alpha";');
29483
29483
  YE('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
29484
- YE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Tue Apr 16 2024 10:30:30 GMT+0200 (Central European Summer Time)";');
29485
- const hC = "3.37.1-alpha", WU = "undefined", cT = "Tue Apr 16 2024 10:30:30 GMT+0200 (Central European Summer Time)";
29484
+ YE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Apr 17 2024 08:57:30 GMT+0200 (Central European Summer Time)";');
29485
+ const hC = "3.37.2-alpha", WU = "undefined", cT = "Wed Apr 17 2024 08:57:30 GMT+0200 (Central European Summer Time)";
29486
29486
  ET && console.log(`Engine version: ${hC} (generator: ${WU})
29487
29487
  Project built at ${cT}`);
29488
29488
  const Ra = "needle_isActiveInHierarchy", mQ = "builtin_components", Ef = "needle_editor_guid";
@@ -34096,7 +34096,7 @@ const $D = class {
34096
34096
  r(this, "tokenId");
34097
34097
  r(this, "affectedObjects");
34098
34098
  r(this, "easeType");
34099
- r(this, "motionType");
34099
+ r(this, "motionType", "none");
34100
34100
  r(this, "duration");
34101
34101
  r(this, "moveDistance");
34102
34102
  r(this, "style");
@@ -34120,7 +34120,7 @@ const $D = class {
34120
34120
  return Object.assign(A, this), A.id = e, A;
34121
34121
  }
34122
34122
  writeTo(A, e) {
34123
- e.beginBlock(`def Preliminary_Action "${this.id}"`), this.affectedObjects && (typeof this.affectedObjects != "string" && (this.affectedObjects = hk(this.affectedObjects, A)), e.appendLine("rel affectedObjects = " + this.affectedObjects)), typeof this.duration == "number" && e.appendLine(`double duration = ${this.duration} `), this.easeType && e.appendLine(`token easeType = "${this.easeType}"`), this.tokenId && e.appendLine(`token info:id = "${this.tokenId}"`), this.motionType && e.appendLine(`token motionType = "${this.motionType}"`), typeof this.moveDistance == "number" && e.appendLine(`double moveDistance = ${this.moveDistance} `), this.style && e.appendLine(`token style = "${this.style}"`), this.type && e.appendLine(`token type = "${this.type}"`), this.front && e.appendLine(`vector3d front = (${this.front.x}, ${this.front.y}, ${this.front.z})`), this.up && e.appendLine(`vector3d upVector = (${this.up.x}, ${this.up.y}, ${this.up.z})`), typeof this.start == "number" && e.appendLine(`double start = ${this.start} `), typeof this.animationSpeed == "number" && e.appendLine(`double animationSpeed = ${this.animationSpeed} `), typeof this.reversed == "boolean" && e.appendLine(`bool reversed = ${this.reversed}`), typeof this.pingPong == "boolean" && e.appendLine(`bool reverses = ${this.pingPong}`), this.xFormTarget && (typeof this.xFormTarget != "string" && (this.xFormTarget = hk(this.xFormTarget, A)), e.appendLine(`rel xformTarget = ${this.xFormTarget}`)), typeof this.audio == "string" && e.appendLine(`asset audio = @${this.audio}@`), typeof this.gain == "number" && e.appendLine(`double gain = ${this.gain}`), typeof this.auralMode == "string" && e.appendLine(`token auralMode = "${this.auralMode}"`), typeof this.multiplePerformOperation == "string" && e.appendLine(`token multiplePerformOperation = "${this.multiplePerformOperation}"`), e.closeBlock();
34123
+ e.beginBlock(`def Preliminary_Action "${this.id}"`), this.affectedObjects && (typeof this.affectedObjects != "string" && (this.affectedObjects = hk(this.affectedObjects, A)), e.appendLine("rel affectedObjects = " + this.affectedObjects)), typeof this.duration == "number" && e.appendLine(`double duration = ${this.duration} `), this.easeType && e.appendLine(`token easeType = "${this.easeType}"`), this.tokenId && e.appendLine(`token info:id = "${this.tokenId}"`), e.appendLine(`token motionType = "${this.motionType}"`), typeof this.moveDistance == "number" && e.appendLine(`double moveDistance = ${this.moveDistance} `), this.style && e.appendLine(`token style = "${this.style}"`), this.type && e.appendLine(`token type = "${this.type}"`), this.front && e.appendLine(`vector3d front = (${this.front.x}, ${this.front.y}, ${this.front.z})`), this.up && e.appendLine(`vector3d upVector = (${this.up.x}, ${this.up.y}, ${this.up.z})`), typeof this.start == "number" && e.appendLine(`double start = ${this.start} `), typeof this.animationSpeed == "number" && e.appendLine(`double animationSpeed = ${this.animationSpeed} `), typeof this.reversed == "boolean" && e.appendLine(`bool reversed = ${this.reversed}`), typeof this.pingPong == "boolean" && e.appendLine(`bool reverses = ${this.pingPong}`), this.xFormTarget && (typeof this.xFormTarget != "string" && (this.xFormTarget = hk(this.xFormTarget, A)), e.appendLine(`rel xformTarget = ${this.xFormTarget}`)), typeof this.audio == "string" && e.appendLine(`asset audio = @${this.audio}@`), typeof this.gain == "number" && e.appendLine(`double gain = ${this.gain}`), typeof this.auralMode == "string" && e.appendLine(`token auralMode = "${this.auralMode}"`), typeof this.multiplePerformOperation == "string" && e.appendLine(`token multiplePerformOperation = "${this.multiplePerformOperation}"`), e.closeBlock();
34124
34124
  }
34125
34125
  };
34126
34126
  let Ho = $D;
@@ -34157,7 +34157,7 @@ class Et {
34157
34157
  }
34158
34158
  static fadeAction(A, e, t) {
34159
34159
  const i = new Ho(A);
34160
- return i.tokenId = "Visibility", i.type = t ? "show" : "hide", i.duration = e, i.style = "basic", i.motionType = void 0, i.moveDistance = 0, i.easeType = "none", i;
34160
+ return i.tokenId = "Visibility", i.type = t ? "show" : "hide", i.duration = e, i.style = "basic", i.motionType = "none", i.moveDistance = 0, i.easeType = "none", i;
34161
34161
  }
34162
34162
  /**
34163
34163
  * creates an action that plays an animation
@@ -35097,7 +35097,8 @@ The script will be ignored. Please make sure your component extends "Behaviour"
35097
35097
  if (e.destroyed)
35098
35098
  continue;
35099
35099
  if (!e.gameObject) {
35100
- console.error("MISSING GAMEOBJECT - will ignore", e), ti.splice(A, 1), A--;
35100
+ console.warn(`Component can not be initialized: no GameObject assigned.
35101
+ Did you add and remove a component in the same frame?`), ti.splice(A, 1), A--;
35101
35102
  continue;
35102
35103
  }
35103
35104
  e.context = g, Vh(e.gameObject), iR(e, g);
@@ -35117,7 +35118,7 @@ The script will be ignored. Please make sure your component extends "Behaviour"
35117
35118
  } catch (t) {
35118
35119
  console.error(t);
35119
35120
  }
35120
- e.__internalAwake !== void 0 && (e.gameObject || console.error("MISSING GAMEOBJECT", e, e.gameObject), Vh(e.gameObject), e.activeAndEnabled && AB(e.__internalAwake.bind(e)));
35121
+ e.__internalAwake !== void 0 && (e.gameObject || console.error("Calling awake for a component without a GameObject", e, e.gameObject), Vh(e.gameObject), e.activeAndEnabled && AB(e.__internalAwake.bind(e)));
35121
35122
  } catch (e) {
35122
35123
  console.error(e), nC(ti[A], g), ti.splice(A, 1), A--;
35123
35124
  }
@@ -74480,42 +74481,41 @@ class PR {
74480
74481
  return "Physics";
74481
74482
  }
74482
74483
  onExportObject(A, e, t) {
74483
- const i = aA.getComponents(A, _t).filter((C) => C.enabled), I = aA.getComponents(A, os).filter((C) => C.enabled && !C.isTrigger);
74484
+ const i = aA.getComponents(A, _t).filter((n) => n.enabled), I = aA.getComponents(A, os).filter((n) => n.enabled && !n.isTrigger);
74484
74485
  let o = i.length > 0 ? i[0] : null;
74485
74486
  const s = I.length > 0 ? I[0] : null;
74486
- let n;
74487
- s && !o && (o = aA.addComponent(A, _t), o.isKinematic = !0, n = o), o && (e.addEventListener("serialize", (C, a) => {
74488
- var B, Q, E;
74487
+ s && !o && (o = new _t(), o.isKinematic = !0), o && e.addEventListener("serialize", (n, C) => {
74488
+ var a, B, Q;
74489
74489
  if (o) {
74490
- if (C.appendLine(), C.beginBlock('def RealityKitComponent "RigidBody"', "{", !0), o.useGravity || C.appendLine("bool gravityEnabled = 0"), C.appendLine('uniform token info:id = "RealityKit.RigidBody"'), o.isKinematic && C.appendLine('token motionType = "Kinematic"'), C.beginBlock('def RealityKitStruct "massFrame"', "{", !0), C.appendLine(`float m_mass = ${o.mass}`), C.beginBlock('def RealityKitStruct "m_pose"', "{", !0), C.appendLine(`float3 position = (${o.centerOfMass.x}, ${o.centerOfMass.y}, ${o.centerOfMass.z})`), C.closeBlock("}"), C.closeBlock("}"), I.length > 0) {
74491
- const c = I[0];
74492
- C.beginBlock('def RealityKitStruct "material"', "{", !0);
74493
- const d = c.sharedMaterial;
74494
- d && d.dynamicFriction !== void 0 && C.appendLine(`double dynamicFriction = ${(B = c.sharedMaterial) == null ? void 0 : B.dynamicFriction}`), d && d.bounciness !== void 0 && C.appendLine(`double restitution = ${(Q = c.sharedMaterial) == null ? void 0 : Q.bounciness}`), d && d.staticFriction !== void 0 && C.appendLine(`double staticFriction = ${(E = c.sharedMaterial) == null ? void 0 : E.staticFriction}`), C.closeBlock("}");
74490
+ if (n.appendLine(), n.beginBlock('def RealityKitComponent "RigidBody"', "{", !0), o.useGravity || n.appendLine("bool gravityEnabled = 0"), n.appendLine('uniform token info:id = "RealityKit.RigidBody"'), o.isKinematic && n.appendLine('token motionType = "Kinematic"'), n.beginBlock('def RealityKitStruct "massFrame"', "{", !0), n.appendLine(`float m_mass = ${o.mass}`), n.beginBlock('def RealityKitStruct "m_pose"', "{", !0), n.appendLine(`float3 position = (${o.centerOfMass.x}, ${o.centerOfMass.y}, ${o.centerOfMass.z})`), n.closeBlock("}"), n.closeBlock("}"), I.length > 0) {
74491
+ const E = I[0];
74492
+ n.beginBlock('def RealityKitStruct "material"', "{", !0);
74493
+ const c = E.sharedMaterial;
74494
+ c && c.dynamicFriction !== void 0 && n.appendLine(`double dynamicFriction = ${(a = E.sharedMaterial) == null ? void 0 : a.dynamicFriction}`), c && c.bounciness !== void 0 && n.appendLine(`double restitution = ${(B = E.sharedMaterial) == null ? void 0 : B.bounciness}`), c && c.staticFriction !== void 0 && n.appendLine(`double staticFriction = ${(Q = E.sharedMaterial) == null ? void 0 : Q.staticFriction}`), n.closeBlock("}");
74495
74495
  }
74496
- C.closeBlock("}");
74497
- }
74498
- }), n && aA.removeComponent(n)), s && (e.addEventListener("serialize", (C, a) => {
74499
- var E;
74500
- C.beginBlock('def RealityKitComponent "Collider"', "{", !0), C.appendLine("uint group = 1"), C.appendLine('uniform token info:id = "RealityKit.Collider"'), C.appendLine("uint mask = 4294967295");
74501
- const Q = s.isTrigger ? "Trigger" : "Default";
74502
- if (C.appendLine(`token type = "${Q}"`), C.beginBlock('def RealityKitStruct "Shape"', "{", !0), s instanceof xd) {
74503
- const c = s;
74504
- C.appendLine('token shapeType = "Sphere"'), C.appendLine(`float radius = ${c.radius}`);
74496
+ n.closeBlock("}");
74497
+ }
74498
+ }), s && (e.addEventListener("serialize", (n, C) => {
74499
+ var Q;
74500
+ n.beginBlock('def RealityKitComponent "Collider"', "{", !0), n.appendLine("uint group = 1"), n.appendLine('uniform token info:id = "RealityKit.Collider"'), n.appendLine("uint mask = 4294967295");
74501
+ const B = s.isTrigger ? "Trigger" : "Default";
74502
+ if (n.appendLine(`token type = "${B}"`), n.beginBlock('def RealityKitStruct "Shape"', "{", !0), s instanceof xd) {
74503
+ const E = s;
74504
+ n.appendLine('token shapeType = "Sphere"'), n.appendLine(`float radius = ${E.radius}`);
74505
74505
  } else if (s instanceof Ld) {
74506
- const c = s;
74507
- C.appendLine('token shapeType = "Box"'), C.appendLine(`float3 extent = (${c.size.x}, ${c.size.y}, ${c.size.z})`);
74506
+ const E = s;
74507
+ n.appendLine('token shapeType = "Box"'), n.appendLine(`float3 extent = (${E.size.x}, ${E.size.y}, ${E.size.z})`);
74508
74508
  } else if (s instanceof Ta) {
74509
- const c = s;
74510
- C.appendLine('token shapeType = "Capsule"'), C.appendLine(`float radius = ${c.radius}`), C.appendLine(`float height = ${c.height}`);
74511
- } else if (s instanceof tc && ((E = s.sharedMesh) != null && E.geometry)) {
74512
- const c = s.sharedMesh.geometry;
74513
- c.boundingBox || c.computeBoundingBox();
74514
- const d = s.sharedMesh.geometry.boundingBox;
74515
- d && (C.appendLine('token shapeType = "Box"'), C.appendLine(`float3 extent = (${d.max.x - d.min.x}, ${d.max.y - d.min.y}, ${d.max.z - d.min.z})`), console.log("[USDZ]: Only Box, Sphere, and Capsule colliders are supported in visionOS/iOS. MeshCollider will be exported as Box", s));
74509
+ const E = s;
74510
+ n.appendLine('token shapeType = "Capsule"'), n.appendLine(`float radius = ${E.radius}`), n.appendLine(`float height = ${E.height}`);
74511
+ } else if (s instanceof tc && ((Q = s.sharedMesh) != null && Q.geometry)) {
74512
+ const E = s.sharedMesh.geometry;
74513
+ E.boundingBox || E.computeBoundingBox();
74514
+ const c = s.sharedMesh.geometry.boundingBox;
74515
+ c && (n.appendLine('token shapeType = "Box"'), n.appendLine(`float3 extent = (${c.max.x - c.min.x}, ${c.max.y - c.min.y}, ${c.max.z - c.min.z})`), console.log("[USDZ]: Only Box, Sphere, and Capsule colliders are supported in visionOS/iOS. MeshCollider will be exported as Box", s));
74516
74516
  } else
74517
74517
  console.warn("[USDZ]: Only Box, Sphere, and Capsule colliders are supported in visionOS/iOS. Ignoring collider:", s);
74518
- C.beginBlock('def RealityKitStruct "pose"', "{", !0), C.closeBlock("}"), C.closeBlock("}"), C.closeBlock("}");
74518
+ n.beginBlock('def RealityKitStruct "pose"', "{", !0), n.closeBlock("}"), n.closeBlock("}"), n.closeBlock("}");
74519
74519
  }), I.length > 1 && console.log("WARNING: Multiple colliders detected. visionOS / iOS can only support objects with a single collider, only exporting the first collider: ", s));
74520
74520
  }
74521
74521
  }
@@ -89466,12 +89466,12 @@ class wN extends RA {
89466
89466
  /** Call to enable or disable default controller behaviour */
89467
89467
  setDefaultMovementEnabled(e) {
89468
89468
  let t = this.gameObject.getComponent(Js);
89469
- return !t && e && (t = this.gameObject.addNewComponent(Js), this._createdComponentsInSession.push(t)), t && (t.enabled = e), t;
89469
+ return !t && e && (t = this.gameObject.addComponent(Js), this._createdComponentsInSession.push(t)), t && (t.enabled = e), t;
89470
89470
  }
89471
89471
  /** Call to enable or disable default controller rendering */
89472
89472
  setDefaultControllerRenderingEnabled(e) {
89473
89473
  let t = this.gameObject.getComponent(kC);
89474
- return !t && e && (t = this.gameObject.addNewComponent(kC), this._createdComponentsInSession.push(t), t.createControllerModel = this.showControllerModels, t.createHandModel == this.showHandModels), t && (t.enabled = e), t;
89474
+ return !t && e && (t = this.gameObject.addComponent(kC), this._createdComponentsInSession.push(t), t.createControllerModel = this.showControllerModels, t.createHandModel == this.showHandModels), t && (t.enabled = e), t;
89475
89475
  }
89476
89476
  async createLocalAvatar(e) {
89477
89477
  this._playerSync && e.running && (this._playerSync.asset = this.defaultAvatar, await this._playerSync.getInstance());
@@ -98163,6 +98163,7 @@ export {
98163
98163
  ic as BoxGizmo,
98164
98164
  ys as BoxHelperComponent,
98165
98165
  Va as Button,
98166
+ Bn as ButtonsFactory,
98166
98167
  ngA as CallDirection,
98167
98168
  Vl as CallInfo,
98168
98169
  Xt as Camera,
@@ -29476,13 +29476,13 @@ function rue(s) {
29476
29476
  jE = s;
29477
29477
  }
29478
29478
  const BU = ne("debugdefines");
29479
- mp('if(!globalThis[""3.37.1-alpha""]) globalThis[""3.37.1-alpha""] = "0.0.0";');
29479
+ mp('if(!globalThis[""3.37.2-alpha""]) globalThis[""3.37.2-alpha""] = "0.0.0";');
29480
29480
  mp('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
29481
- mp('if(!globalThis[""Tue Apr 16 2024 10:30:39 GMT+0200 (Central European Summer Time)""]) globalThis[""Tue Apr 16 2024 10:30:39 GMT+0200 (Central European Summer Time)""] = "unknown";');
29482
- mp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.1-alpha";');
29481
+ mp('if(!globalThis[""Wed Apr 17 2024 08:57:40 GMT+0200 (Central European Summer Time)""]) globalThis[""Wed Apr 17 2024 08:57:40 GMT+0200 (Central European Summer Time)""] = "unknown";');
29482
+ mp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.37.2-alpha";');
29483
29483
  mp('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
29484
- mp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Tue Apr 16 2024 10:30:39 GMT+0200 (Central European Summer Time)";');
29485
- const ic = "3.37.1-alpha", kT = "undefined", DU = "Tue Apr 16 2024 10:30:39 GMT+0200 (Central European Summer Time)";
29484
+ mp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Apr 17 2024 08:57:40 GMT+0200 (Central European Summer Time)";');
29485
+ const ic = "3.37.2-alpha", kT = "undefined", DU = "Wed Apr 17 2024 08:57:40 GMT+0200 (Central European Summer Time)";
29486
29486
  BU && console.log(`Engine version: ${ic} (generator: ${kT})
29487
29487
  Project built at ${DU}`);
29488
29488
  const uh = "needle_isActiveInHierarchy", tf = "builtin_components", T0 = "needle_editor_guid";
@@ -34096,7 +34096,7 @@ const ob = class {
34096
34096
  h(this, "tokenId");
34097
34097
  h(this, "affectedObjects");
34098
34098
  h(this, "easeType");
34099
- h(this, "motionType");
34099
+ h(this, "motionType", "none");
34100
34100
  h(this, "duration");
34101
34101
  h(this, "moveDistance");
34102
34102
  h(this, "style");
@@ -34120,7 +34120,7 @@ const ob = class {
34120
34120
  return Object.assign(e, this), e.id = t, e;
34121
34121
  }
34122
34122
  writeTo(e, t) {
34123
- t.beginBlock(`def Preliminary_Action "${this.id}"`), this.affectedObjects && (typeof this.affectedObjects != "string" && (this.affectedObjects = i1(this.affectedObjects, e)), t.appendLine("rel affectedObjects = " + this.affectedObjects)), typeof this.duration == "number" && t.appendLine(`double duration = ${this.duration} `), this.easeType && t.appendLine(`token easeType = "${this.easeType}"`), this.tokenId && t.appendLine(`token info:id = "${this.tokenId}"`), this.motionType && t.appendLine(`token motionType = "${this.motionType}"`), typeof this.moveDistance == "number" && t.appendLine(`double moveDistance = ${this.moveDistance} `), this.style && t.appendLine(`token style = "${this.style}"`), this.type && t.appendLine(`token type = "${this.type}"`), this.front && t.appendLine(`vector3d front = (${this.front.x}, ${this.front.y}, ${this.front.z})`), this.up && t.appendLine(`vector3d upVector = (${this.up.x}, ${this.up.y}, ${this.up.z})`), typeof this.start == "number" && t.appendLine(`double start = ${this.start} `), typeof this.animationSpeed == "number" && t.appendLine(`double animationSpeed = ${this.animationSpeed} `), typeof this.reversed == "boolean" && t.appendLine(`bool reversed = ${this.reversed}`), typeof this.pingPong == "boolean" && t.appendLine(`bool reverses = ${this.pingPong}`), this.xFormTarget && (typeof this.xFormTarget != "string" && (this.xFormTarget = i1(this.xFormTarget, e)), t.appendLine(`rel xformTarget = ${this.xFormTarget}`)), typeof this.audio == "string" && t.appendLine(`asset audio = @${this.audio}@`), typeof this.gain == "number" && t.appendLine(`double gain = ${this.gain}`), typeof this.auralMode == "string" && t.appendLine(`token auralMode = "${this.auralMode}"`), typeof this.multiplePerformOperation == "string" && t.appendLine(`token multiplePerformOperation = "${this.multiplePerformOperation}"`), t.closeBlock();
34123
+ t.beginBlock(`def Preliminary_Action "${this.id}"`), this.affectedObjects && (typeof this.affectedObjects != "string" && (this.affectedObjects = i1(this.affectedObjects, e)), t.appendLine("rel affectedObjects = " + this.affectedObjects)), typeof this.duration == "number" && t.appendLine(`double duration = ${this.duration} `), this.easeType && t.appendLine(`token easeType = "${this.easeType}"`), this.tokenId && t.appendLine(`token info:id = "${this.tokenId}"`), t.appendLine(`token motionType = "${this.motionType}"`), typeof this.moveDistance == "number" && t.appendLine(`double moveDistance = ${this.moveDistance} `), this.style && t.appendLine(`token style = "${this.style}"`), this.type && t.appendLine(`token type = "${this.type}"`), this.front && t.appendLine(`vector3d front = (${this.front.x}, ${this.front.y}, ${this.front.z})`), this.up && t.appendLine(`vector3d upVector = (${this.up.x}, ${this.up.y}, ${this.up.z})`), typeof this.start == "number" && t.appendLine(`double start = ${this.start} `), typeof this.animationSpeed == "number" && t.appendLine(`double animationSpeed = ${this.animationSpeed} `), typeof this.reversed == "boolean" && t.appendLine(`bool reversed = ${this.reversed}`), typeof this.pingPong == "boolean" && t.appendLine(`bool reverses = ${this.pingPong}`), this.xFormTarget && (typeof this.xFormTarget != "string" && (this.xFormTarget = i1(this.xFormTarget, e)), t.appendLine(`rel xformTarget = ${this.xFormTarget}`)), typeof this.audio == "string" && t.appendLine(`asset audio = @${this.audio}@`), typeof this.gain == "number" && t.appendLine(`double gain = ${this.gain}`), typeof this.auralMode == "string" && t.appendLine(`token auralMode = "${this.auralMode}"`), typeof this.multiplePerformOperation == "string" && t.appendLine(`token multiplePerformOperation = "${this.multiplePerformOperation}"`), t.closeBlock();
34124
34124
  }
34125
34125
  };
34126
34126
  let Do = ob;
@@ -34157,7 +34157,7 @@ class li {
34157
34157
  }
34158
34158
  static fadeAction(e, t, i) {
34159
34159
  const n = new Do(e);
34160
- return n.tokenId = "Visibility", n.type = i ? "show" : "hide", n.duration = t, n.style = "basic", n.motionType = void 0, n.moveDistance = 0, n.easeType = "none", n;
34160
+ return n.tokenId = "Visibility", n.type = i ? "show" : "hide", n.duration = t, n.style = "basic", n.motionType = "none", n.moveDistance = 0, n.easeType = "none", n;
34161
34161
  }
34162
34162
  /**
34163
34163
  * creates an action that plays an animation
@@ -35097,7 +35097,8 @@ The script will be ignored. Please make sure your component extends "Behaviour"
35097
35097
  if (t.destroyed)
35098
35098
  continue;
35099
35099
  if (!t.gameObject) {
35100
- console.error("MISSING GAMEOBJECT - will ignore", t), Xi.splice(e, 1), e--;
35100
+ console.warn(`Component can not be initialized: no GameObject assigned.
35101
+ Did you add and remove a component in the same frame?`), Xi.splice(e, 1), e--;
35101
35102
  continue;
35102
35103
  }
35103
35104
  t.context = s, dg(t.gameObject), WT(t, s);
@@ -35117,7 +35118,7 @@ The script will be ignored. Please make sure your component extends "Behaviour"
35117
35118
  } catch (i) {
35118
35119
  console.error(i);
35119
35120
  }
35120
- t.__internalAwake !== void 0 && (t.gameObject || console.error("MISSING GAMEOBJECT", t, t.gameObject), dg(t.gameObject), t.activeAndEnabled && Bu(t.__internalAwake.bind(t)));
35121
+ t.__internalAwake !== void 0 && (t.gameObject || console.error("Calling awake for a component without a GameObject", t, t.gameObject), dg(t.gameObject), t.activeAndEnabled && Bu(t.__internalAwake.bind(t)));
35121
35122
  } catch (t) {
35122
35123
  console.error(t), Xl(Xi[e], s), Xi.splice(e, 1), e--;
35123
35124
  }
@@ -74480,42 +74481,41 @@ class LI {
74480
74481
  return "Physics";
74481
74482
  }
74482
74483
  onExportObject(e, t, i) {
74483
- const n = oe.getComponents(e, Oi).filter((c) => c.enabled), r = oe.getComponents(e, Yo).filter((c) => c.enabled && !c.isTrigger);
74484
+ const n = oe.getComponents(e, Oi).filter((l) => l.enabled), r = oe.getComponents(e, Yo).filter((l) => l.enabled && !l.isTrigger);
74484
74485
  let o = n.length > 0 ? n[0] : null;
74485
74486
  const a = r.length > 0 ? r[0] : null;
74486
- let l;
74487
- a && !o && (o = oe.addComponent(e, Oi), o.isKinematic = !0, l = o), o && (t.addEventListener("serialize", (c, u) => {
74488
- var d, f, p;
74487
+ a && !o && (o = new Oi(), o.isKinematic = !0), o && t.addEventListener("serialize", (l, c) => {
74488
+ var u, d, f;
74489
74489
  if (o) {
74490
- if (c.appendLine(), c.beginBlock('def RealityKitComponent "RigidBody"', "{", !0), o.useGravity || c.appendLine("bool gravityEnabled = 0"), c.appendLine('uniform token info:id = "RealityKit.RigidBody"'), o.isKinematic && c.appendLine('token motionType = "Kinematic"'), c.beginBlock('def RealityKitStruct "massFrame"', "{", !0), c.appendLine(`float m_mass = ${o.mass}`), c.beginBlock('def RealityKitStruct "m_pose"', "{", !0), c.appendLine(`float3 position = (${o.centerOfMass.x}, ${o.centerOfMass.y}, ${o.centerOfMass.z})`), c.closeBlock("}"), c.closeBlock("}"), r.length > 0) {
74491
- const m = r[0];
74492
- c.beginBlock('def RealityKitStruct "material"', "{", !0);
74493
- const A = m.sharedMaterial;
74494
- A && A.dynamicFriction !== void 0 && c.appendLine(`double dynamicFriction = ${(d = m.sharedMaterial) == null ? void 0 : d.dynamicFriction}`), A && A.bounciness !== void 0 && c.appendLine(`double restitution = ${(f = m.sharedMaterial) == null ? void 0 : f.bounciness}`), A && A.staticFriction !== void 0 && c.appendLine(`double staticFriction = ${(p = m.sharedMaterial) == null ? void 0 : p.staticFriction}`), c.closeBlock("}");
74490
+ if (l.appendLine(), l.beginBlock('def RealityKitComponent "RigidBody"', "{", !0), o.useGravity || l.appendLine("bool gravityEnabled = 0"), l.appendLine('uniform token info:id = "RealityKit.RigidBody"'), o.isKinematic && l.appendLine('token motionType = "Kinematic"'), l.beginBlock('def RealityKitStruct "massFrame"', "{", !0), l.appendLine(`float m_mass = ${o.mass}`), l.beginBlock('def RealityKitStruct "m_pose"', "{", !0), l.appendLine(`float3 position = (${o.centerOfMass.x}, ${o.centerOfMass.y}, ${o.centerOfMass.z})`), l.closeBlock("}"), l.closeBlock("}"), r.length > 0) {
74491
+ const p = r[0];
74492
+ l.beginBlock('def RealityKitStruct "material"', "{", !0);
74493
+ const m = p.sharedMaterial;
74494
+ m && m.dynamicFriction !== void 0 && l.appendLine(`double dynamicFriction = ${(u = p.sharedMaterial) == null ? void 0 : u.dynamicFriction}`), m && m.bounciness !== void 0 && l.appendLine(`double restitution = ${(d = p.sharedMaterial) == null ? void 0 : d.bounciness}`), m && m.staticFriction !== void 0 && l.appendLine(`double staticFriction = ${(f = p.sharedMaterial) == null ? void 0 : f.staticFriction}`), l.closeBlock("}");
74495
74495
  }
74496
- c.closeBlock("}");
74497
- }
74498
- }), l && oe.removeComponent(l)), a && (t.addEventListener("serialize", (c, u) => {
74499
- var p;
74500
- c.beginBlock('def RealityKitComponent "Collider"', "{", !0), c.appendLine("uint group = 1"), c.appendLine('uniform token info:id = "RealityKit.Collider"'), c.appendLine("uint mask = 4294967295");
74501
- const f = a.isTrigger ? "Trigger" : "Default";
74502
- if (c.appendLine(`token type = "${f}"`), c.beginBlock('def RealityKitStruct "Shape"', "{", !0), a instanceof Zv) {
74503
- const m = a;
74504
- c.appendLine('token shapeType = "Sphere"'), c.appendLine(`float radius = ${m.radius}`);
74496
+ l.closeBlock("}");
74497
+ }
74498
+ }), a && (t.addEventListener("serialize", (l, c) => {
74499
+ var f;
74500
+ l.beginBlock('def RealityKitComponent "Collider"', "{", !0), l.appendLine("uint group = 1"), l.appendLine('uniform token info:id = "RealityKit.Collider"'), l.appendLine("uint mask = 4294967295");
74501
+ const d = a.isTrigger ? "Trigger" : "Default";
74502
+ if (l.appendLine(`token type = "${d}"`), l.beginBlock('def RealityKitStruct "Shape"', "{", !0), a instanceof Zv) {
74503
+ const p = a;
74504
+ l.appendLine('token shapeType = "Sphere"'), l.appendLine(`float radius = ${p.radius}`);
74505
74505
  } else if (a instanceof $v) {
74506
- const m = a;
74507
- c.appendLine('token shapeType = "Box"'), c.appendLine(`float3 extent = (${m.size.x}, ${m.size.y}, ${m.size.z})`);
74506
+ const p = a;
74507
+ l.appendLine('token shapeType = "Box"'), l.appendLine(`float3 extent = (${p.size.x}, ${p.size.y}, ${p.size.z})`);
74508
74508
  } else if (a instanceof xh) {
74509
- const m = a;
74510
- c.appendLine('token shapeType = "Capsule"'), c.appendLine(`float radius = ${m.radius}`), c.appendLine(`float height = ${m.height}`);
74511
- } else if (a instanceof Mp && ((p = a.sharedMesh) != null && p.geometry)) {
74512
- const m = a.sharedMesh.geometry;
74513
- m.boundingBox || m.computeBoundingBox();
74514
- const A = a.sharedMesh.geometry.boundingBox;
74515
- A && (c.appendLine('token shapeType = "Box"'), c.appendLine(`float3 extent = (${A.max.x - A.min.x}, ${A.max.y - A.min.y}, ${A.max.z - A.min.z})`), console.log("[USDZ]: Only Box, Sphere, and Capsule colliders are supported in visionOS/iOS. MeshCollider will be exported as Box", a));
74509
+ const p = a;
74510
+ l.appendLine('token shapeType = "Capsule"'), l.appendLine(`float radius = ${p.radius}`), l.appendLine(`float height = ${p.height}`);
74511
+ } else if (a instanceof Mp && ((f = a.sharedMesh) != null && f.geometry)) {
74512
+ const p = a.sharedMesh.geometry;
74513
+ p.boundingBox || p.computeBoundingBox();
74514
+ const m = a.sharedMesh.geometry.boundingBox;
74515
+ m && (l.appendLine('token shapeType = "Box"'), l.appendLine(`float3 extent = (${m.max.x - m.min.x}, ${m.max.y - m.min.y}, ${m.max.z - m.min.z})`), console.log("[USDZ]: Only Box, Sphere, and Capsule colliders are supported in visionOS/iOS. MeshCollider will be exported as Box", a));
74516
74516
  } else
74517
74517
  console.warn("[USDZ]: Only Box, Sphere, and Capsule colliders are supported in visionOS/iOS. Ignoring collider:", a);
74518
- c.beginBlock('def RealityKitStruct "pose"', "{", !0), c.closeBlock("}"), c.closeBlock("}"), c.closeBlock("}");
74518
+ l.beginBlock('def RealityKitStruct "pose"', "{", !0), l.closeBlock("}"), l.closeBlock("}"), l.closeBlock("}");
74519
74519
  }), r.length > 1 && console.log("WARNING: Multiple colliders detected. visionOS / iOS can only support objects with a single collider, only exporting the first collider: ", a));
74520
74520
  }
74521
74521
  }
@@ -89466,12 +89466,12 @@ class dR extends Te {
89466
89466
  /** Call to enable or disable default controller behaviour */
89467
89467
  setDefaultMovementEnabled(t) {
89468
89468
  let i = this.gameObject.getComponent(ba);
89469
- return !i && t && (i = this.gameObject.addNewComponent(ba), this._createdComponentsInSession.push(i)), i && (i.enabled = t), i;
89469
+ return !i && t && (i = this.gameObject.addComponent(ba), this._createdComponentsInSession.push(i)), i && (i.enabled = t), i;
89470
89470
  }
89471
89471
  /** Call to enable or disable default controller rendering */
89472
89472
  setDefaultControllerRenderingEnabled(t) {
89473
89473
  let i = this.gameObject.getComponent(pc);
89474
- return !i && t && (i = this.gameObject.addNewComponent(pc), this._createdComponentsInSession.push(i), i.createControllerModel = this.showControllerModels, i.createHandModel == this.showHandModels), i && (i.enabled = t), i;
89474
+ return !i && t && (i = this.gameObject.addComponent(pc), this._createdComponentsInSession.push(i), i.createControllerModel = this.showControllerModels, i.createHandModel == this.showHandModels), i && (i.enabled = t), i;
89475
89475
  }
89476
89476
  async createLocalAvatar(t) {
89477
89477
  this._playerSync && t.running && (this._playerSync.asset = this.defaultAvatar, await this._playerSync.getInstance());
@@ -94747,6 +94747,7 @@ export {
94747
94747
  Tp as BoxGizmo,
94748
94748
  ha as BoxHelperComponent,
94749
94749
  Ih as Button,
94750
+ Ka as ButtonsFactory,
94750
94751
  Pie as CallDirection,
94751
94752
  fv as CallInfo,
94752
94753
  Vi as Camera,