@needle-tools/engine 4.3.0-alpha → 4.3.0-alpha.1

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 (101) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/needle-engine.bundle.js +1467 -222
  3. package/dist/needle-engine.bundle.light.js +1467 -222
  4. package/dist/needle-engine.bundle.light.min.js +32 -32
  5. package/dist/needle-engine.bundle.light.umd.cjs +3 -3
  6. package/dist/needle-engine.bundle.min.js +3 -3
  7. package/dist/needle-engine.bundle.umd.cjs +3 -3
  8. package/dist/needle-engine.light.d.ts +9 -9
  9. package/lib/engine/engine_types.d.ts +162 -17
  10. package/lib/engine-components/Animator.d.ts +129 -21
  11. package/lib/engine-components/Animator.js +115 -21
  12. package/lib/engine-components/Animator.js.map +1 -1
  13. package/lib/engine-components/AnimatorController.d.ts +161 -32
  14. package/lib/engine-components/AnimatorController.js +176 -29
  15. package/lib/engine-components/AnimatorController.js.map +1 -1
  16. package/lib/engine-components/AudioListener.d.ts +16 -5
  17. package/lib/engine-components/AudioListener.js +16 -5
  18. package/lib/engine-components/AudioListener.js.map +1 -1
  19. package/lib/engine-components/AudioSource.d.ts +120 -28
  20. package/lib/engine-components/AudioSource.js +120 -37
  21. package/lib/engine-components/AudioSource.js.map +1 -1
  22. package/lib/engine-components/AvatarLoader.d.ts +61 -0
  23. package/lib/engine-components/AvatarLoader.js +61 -1
  24. package/lib/engine-components/AvatarLoader.js.map +1 -1
  25. package/lib/engine-components/AxesHelper.d.ts +19 -1
  26. package/lib/engine-components/AxesHelper.js +19 -1
  27. package/lib/engine-components/AxesHelper.js.map +1 -1
  28. package/lib/engine-components/BoxHelperComponent.d.ts +26 -0
  29. package/lib/engine-components/BoxHelperComponent.js +26 -0
  30. package/lib/engine-components/BoxHelperComponent.js.map +1 -1
  31. package/lib/engine-components/Camera.d.ts +126 -37
  32. package/lib/engine-components/Camera.js +139 -37
  33. package/lib/engine-components/Camera.js.map +1 -1
  34. package/lib/engine-components/CameraUtils.js +20 -0
  35. package/lib/engine-components/CameraUtils.js.map +1 -1
  36. package/lib/engine-components/Collider.d.ts +95 -21
  37. package/lib/engine-components/Collider.js +100 -23
  38. package/lib/engine-components/Collider.js.map +1 -1
  39. package/lib/engine-components/Component.d.ts +554 -106
  40. package/lib/engine-components/Component.js +352 -81
  41. package/lib/engine-components/Component.js.map +1 -1
  42. package/lib/engine-components/DragControls.d.ts +95 -21
  43. package/lib/engine-components/DragControls.js +126 -32
  44. package/lib/engine-components/DragControls.js.map +1 -1
  45. package/lib/engine-components/DropListener.d.ts +99 -16
  46. package/lib/engine-components/DropListener.js +119 -14
  47. package/lib/engine-components/DropListener.js.map +1 -1
  48. package/lib/engine-components/Light.d.ts +102 -5
  49. package/lib/engine-components/Light.js +102 -44
  50. package/lib/engine-components/Light.js.map +1 -1
  51. package/lib/engine-components/NeedleMenu.d.ts +28 -11
  52. package/lib/engine-components/NeedleMenu.js +28 -11
  53. package/lib/engine-components/NeedleMenu.js.map +1 -1
  54. package/lib/engine-components/Networking.d.ts +37 -5
  55. package/lib/engine-components/Networking.js +37 -5
  56. package/lib/engine-components/Networking.js.map +1 -1
  57. package/lib/engine-components/SceneSwitcher.js +44 -0
  58. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  59. package/lib/engine-components/SpatialTrigger.d.ts +66 -1
  60. package/lib/engine-components/SpatialTrigger.js +74 -2
  61. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  62. package/lib/engine-components/SpectatorCamera.d.ts +66 -4
  63. package/lib/engine-components/SpectatorCamera.js +132 -6
  64. package/lib/engine-components/SpectatorCamera.js.map +1 -1
  65. package/lib/engine-components/SyncedTransform.d.ts +45 -6
  66. package/lib/engine-components/SyncedTransform.js +45 -6
  67. package/lib/engine-components/SyncedTransform.js.map +1 -1
  68. package/lib/engine-components/TransformGizmo.d.ts +49 -3
  69. package/lib/engine-components/TransformGizmo.js +49 -3
  70. package/lib/engine-components/TransformGizmo.js.map +1 -1
  71. package/lib/engine-components/webxr/WebXR.d.ts +131 -22
  72. package/lib/engine-components/webxr/WebXR.js +132 -23
  73. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  74. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +82 -9
  75. package/lib/engine-components-experimental/networking/PlayerSync.js +76 -11
  76. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  77. package/package.json +1 -1
  78. package/src/engine/engine_types.ts +179 -18
  79. package/src/engine-components/Animator.ts +142 -22
  80. package/src/engine-components/AnimatorController.ts +184 -34
  81. package/src/engine-components/AudioListener.ts +16 -5
  82. package/src/engine-components/AudioSource.ts +126 -37
  83. package/src/engine-components/AvatarLoader.ts +61 -2
  84. package/src/engine-components/AxesHelper.ts +21 -1
  85. package/src/engine-components/BoxHelperComponent.ts +26 -0
  86. package/src/engine-components/Camera.ts +147 -41
  87. package/src/engine-components/CameraUtils.ts +20 -0
  88. package/src/engine-components/Collider.ts +102 -27
  89. package/src/engine-components/Component.ts +605 -129
  90. package/src/engine-components/DragControls.ts +134 -38
  91. package/src/engine-components/DropListener.ts +143 -23
  92. package/src/engine-components/Light.ts +105 -44
  93. package/src/engine-components/NeedleMenu.ts +29 -11
  94. package/src/engine-components/Networking.ts +37 -6
  95. package/src/engine-components/SceneSwitcher.ts +48 -1
  96. package/src/engine-components/SpatialTrigger.ts +80 -3
  97. package/src/engine-components/SpectatorCamera.ts +136 -18
  98. package/src/engine-components/SyncedTransform.ts +50 -7
  99. package/src/engine-components/TransformGizmo.ts +49 -4
  100. package/src/engine-components/webxr/WebXR.ts +144 -27
  101. package/src/engine-components-experimental/networking/PlayerSync.ts +85 -13
@@ -15,7 +15,12 @@ const debug = utils.getParam("debugsync");
15
15
  export const SyncedTransformIdentifier = "STRS";
16
16
  registerBinaryType(SyncedTransformIdentifier, SyncedTransformModel.getRootAsSyncedTransformModel);
17
17
  const builder = new flatbuffers.Builder();
18
- /** Creates a flatbuffer model containing the transform data of a game object. Used by {@link SyncedTransform}
18
+ /**
19
+ * Creates a flatbuffer model containing the transform data of a game object. Used by {@link SyncedTransform}
20
+ * @param guid The unique identifier of the object to sync
21
+ * @param b The behavior component containing transform data
22
+ * @param fast Whether to use fast mode synchronization (syncs more frequently)
23
+ * @returns A Uint8Array containing the serialized transform data
19
24
  */
20
25
  export function createTransformModel(guid, b, fast = true) {
21
26
  builder.clear();
@@ -44,16 +49,22 @@ onUpdate((ctx) => {
44
49
  console.log("Sync Transform Fast Interval", FAST_INTERVAL);
45
50
  });
46
51
  /**
47
- * SyncedTransform is a behaviour that syncs the transform of a game object over the network.
52
+ * SyncedTransform synchronizes the position and rotation of a game object over the network.
53
+ * It handles ownership transfer, interpolation, and network state updates automatically.
48
54
  * @category Networking
49
55
  * @group Components
50
56
  */
51
57
  export class SyncedTransform extends Behaviour {
52
58
  // public autoOwnership: boolean = true;
59
+ /** When true, overrides physics behavior when this object is owned by the local user */
53
60
  overridePhysics = true;
61
+ /** Whether to smoothly interpolate position changes when receiving updates */
54
62
  interpolatePosition = true;
63
+ /** Whether to smoothly interpolate rotation changes when receiving updates */
55
64
  interpolateRotation = true;
65
+ /** When true, sends updates at a higher frequency, useful for fast-moving objects */
56
66
  fastMode = false;
67
+ /** When true, notifies other clients when this object is destroyed */
57
68
  syncDestroy = false;
58
69
  // private _state!: SyncedTransformModel;
59
70
  _model = null;
@@ -65,7 +76,10 @@ export class SyncedTransform extends Behaviour {
65
76
  _targetRotation;
66
77
  _receivedFastUpdate = false;
67
78
  _shouldRequestOwnership = false;
68
- /** Request ownership of an object - you need to be connected to a room */
79
+ /**
80
+ * Requests ownership of this object on the network.
81
+ * You need to be connected to a room for this to work.
82
+ */
69
83
  requestOwnership() {
70
84
  if (debug)
71
85
  console.log("Request ownership");
@@ -76,9 +90,17 @@ export class SyncedTransform extends Behaviour {
76
90
  else
77
91
  this._model.requestOwnership();
78
92
  }
93
+ /**
94
+ * Checks if this client has ownership of the object
95
+ * @returns true if this client has ownership, false if not, undefined if ownership state is unknown
96
+ */
79
97
  hasOwnership() {
80
98
  return this._model?.hasOwnership ?? undefined;
81
99
  }
100
+ /**
101
+ * Checks if the object is owned by any client
102
+ * @returns true if the object is owned, false if not, undefined if ownership state is unknown
103
+ */
82
104
  isOwned() {
83
105
  return this._model?.isOwned;
84
106
  }
@@ -118,12 +140,19 @@ export class SyncedTransform extends Behaviour {
118
140
  this.context.connection.stopListen(RoomEvents.JoinedRoom, this.joinedRoomCallback);
119
141
  this.context.connection.stopListenBinary(SyncedTransformIdentifier, this.receivedDataCallback);
120
142
  }
143
+ /**
144
+ * Attempts to retrieve and apply the last known network state for this transform
145
+ */
121
146
  tryGetLastState() {
122
147
  const model = this.context.connection.tryGetState(this.guid);
123
148
  if (model)
124
149
  this.onReceivedData(model);
125
150
  }
126
151
  tempEuler = new Euler();
152
+ /**
153
+ * Handles incoming network data for this transform
154
+ * @param data The model containing transform information
155
+ */
127
156
  onReceivedData(data) {
128
157
  if (this.destroyed)
129
158
  return;
@@ -158,7 +187,10 @@ export class SyncedTransform extends Behaviour {
158
187
  // }
159
188
  }
160
189
  }
161
- /** @internal */
190
+ /**
191
+ * @internal
192
+ * Initializes tracking of position and rotation when component is enabled
193
+ */
162
194
  onEnable() {
163
195
  this.lastWorldPos.copy(this.worldPosition);
164
196
  this.lastWorldRotation.copy(this.worldQuaternion);
@@ -168,7 +200,10 @@ export class SyncedTransform extends Behaviour {
168
200
  this._model.updateIsOwned();
169
201
  }
170
202
  }
171
- /** @internal */
203
+ /**
204
+ * @internal
205
+ * Releases ownership when component is disabled
206
+ */
172
207
  onDisable() {
173
208
  if (this._model)
174
209
  this._model.freeOwnership();
@@ -176,7 +211,11 @@ export class SyncedTransform extends Behaviour {
176
211
  receivedUpdate = false;
177
212
  lastWorldPos;
178
213
  lastWorldRotation;
179
- /** @internal */
214
+ /**
215
+ * @internal
216
+ * Handles transform synchronization before each render frame
217
+ * Sends updates when owner, receives and applies updates when not owner
218
+ */
180
219
  onBeforeRender() {
181
220
  if (!this.activeAndEnabled || !this.context.connection.isConnected)
182
221
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"SyncedTransform.js","sourceRoot":"","sources":["../../src/engine-components/SyncedTransform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,KAAK,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAChD,kBAAkB,CAAC,yBAAyB,EAAE,oBAAoB,CAAC,6BAA6B,CAAC,CAAC;AAElG,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;AAE1C;GACG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,CAAY,EAAE,OAAgB,IAAI;IACjF,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,MAAM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AAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAE5H,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC1B,MAAM,EAAE,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC5E,qCAAqC;YACrC,gDAAgD;YAChD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;SAC1C;IACL,CAAC;CACJ"}
@@ -1,18 +1,34 @@
1
1
  import { TransformControls } from "three/examples/jsm/controls/TransformControls.js";
2
2
  import { Behaviour } from "./Component.js";
3
3
  /**
4
- * TransformGizmo is a component that displays a gizmo for transforming the object in the scene.
4
+ * TransformGizmo displays manipulation controls for translating, rotating, and scaling objects in the scene.
5
+ * It wraps three.js {@link TransformControls} and provides keyboard shortcuts for changing modes and settings.
5
6
  * @category Helpers
6
7
  * @group Components
7
8
  */
8
9
  export declare class TransformGizmo extends Behaviour {
10
+ /**
11
+ * When true, this is considered a helper gizmo and will only be shown if showGizmos is enabled in engine parameters.
12
+ */
9
13
  isGizmo: boolean;
14
+ /**
15
+ * Specifies the translation grid snap value in world units.
16
+ * Applied when holding Shift while translating an object.
17
+ */
10
18
  translationSnap: number;
19
+ /**
20
+ * Specifies the rotation snap angle in degrees.
21
+ * Applied when holding Shift while rotating an object.
22
+ */
11
23
  rotationSnapAngle: number;
24
+ /**
25
+ * Specifies the scale snapping value.
26
+ * Applied when holding Shift while scaling an object.
27
+ */
12
28
  scaleSnap: number;
13
29
  /**
14
- * Get the underlying three.js TransformControls instance.
15
- * @returns The TransformControls instance.
30
+ * Gets the underlying three.js {@link TransformControls} instance.
31
+ * @returns The TransformControls instance or undefined if not initialized.
16
32
  */
17
33
  get control(): TransformControls | undefined;
18
34
  private _control?;
@@ -21,9 +37,39 @@ export declare class TransformGizmo extends Behaviour {
21
37
  onEnable(): void;
22
38
  /** @internal */
23
39
  onDisable(): void;
40
+ /**
41
+ * Enables grid snapping for transform operations according to set snap values.
42
+ * This applies the translationSnap, rotationSnapAngle, and scaleSnap properties to the controls.
43
+ */
24
44
  enableSnapping(): void;
45
+ /**
46
+ * Disables grid snapping for transform operations.
47
+ * Removes all snapping constraints from the transform controls.
48
+ */
25
49
  disableSnapping(): void;
50
+ /**
51
+ * Event handler for when dragging state changes.
52
+ * Disables orbit controls during dragging and requests ownership of the transform if it's synchronized.
53
+ * @param event The drag change event
54
+ */
26
55
  private onControlChangedEvent;
56
+ /**
57
+ * Handles keyboard shortcuts for transform operations:
58
+ * - Q: Toggle local/world space
59
+ * - W: Translation mode
60
+ * - E: Rotation mode
61
+ * - R: Scale mode
62
+ * - Shift: Enable snapping (while held)
63
+ * - +/-: Adjust gizmo size
64
+ * - X/Y/Z: Toggle visibility of respective axis
65
+ * - Spacebar: Toggle controls enabled state
66
+ * @param event The keyboard event
67
+ */
27
68
  private windowKeyDownListener;
69
+ /**
70
+ * Handles keyboard key release events.
71
+ * Currently only handles releasing Shift key to disable snapping.
72
+ * @param event The keyboard event
73
+ */
28
74
  private windowKeyUpListener;
29
75
  }
@@ -12,18 +12,34 @@ import { Behaviour, GameObject } from "./Component.js";
12
12
  import { OrbitControls } from "./OrbitControls.js";
13
13
  import { SyncedTransform } from "./SyncedTransform.js";
14
14
  /**
15
- * TransformGizmo is a component that displays a gizmo for transforming the object in the scene.
15
+ * TransformGizmo displays manipulation controls for translating, rotating, and scaling objects in the scene.
16
+ * It wraps three.js {@link TransformControls} and provides keyboard shortcuts for changing modes and settings.
16
17
  * @category Helpers
17
18
  * @group Components
18
19
  */
19
20
  export class TransformGizmo extends Behaviour {
21
+ /**
22
+ * When true, this is considered a helper gizmo and will only be shown if showGizmos is enabled in engine parameters.
23
+ */
20
24
  isGizmo = false;
25
+ /**
26
+ * Specifies the translation grid snap value in world units.
27
+ * Applied when holding Shift while translating an object.
28
+ */
21
29
  translationSnap = 1;
30
+ /**
31
+ * Specifies the rotation snap angle in degrees.
32
+ * Applied when holding Shift while rotating an object.
33
+ */
22
34
  rotationSnapAngle = 15;
35
+ /**
36
+ * Specifies the scale snapping value.
37
+ * Applied when holding Shift while scaling an object.
38
+ */
23
39
  scaleSnap = .25;
24
40
  /**
25
- * Get the underlying three.js TransformControls instance.
26
- * @returns The TransformControls instance.
41
+ * Gets the underlying three.js {@link TransformControls} instance.
42
+ * @returns The TransformControls instance or undefined if not initialized.
27
43
  */
28
44
  get control() {
29
45
  return this._control;
@@ -70,6 +86,10 @@ export class TransformGizmo extends Behaviour {
70
86
  window.removeEventListener('keydown', this.windowKeyDownListener);
71
87
  window.removeEventListener('keyup', this.windowKeyUpListener);
72
88
  }
89
+ /**
90
+ * Enables grid snapping for transform operations according to set snap values.
91
+ * This applies the translationSnap, rotationSnapAngle, and scaleSnap properties to the controls.
92
+ */
73
93
  enableSnapping() {
74
94
  if (this._control) {
75
95
  this._control.setTranslationSnap(this.translationSnap);
@@ -77,6 +97,10 @@ export class TransformGizmo extends Behaviour {
77
97
  this._control.setScaleSnap(this.scaleSnap);
78
98
  }
79
99
  }
100
+ /**
101
+ * Disables grid snapping for transform operations.
102
+ * Removes all snapping constraints from the transform controls.
103
+ */
80
104
  disableSnapping() {
81
105
  if (this._control) {
82
106
  this._control.setTranslationSnap(null);
@@ -84,6 +108,11 @@ export class TransformGizmo extends Behaviour {
84
108
  this._control.setScaleSnap(null);
85
109
  }
86
110
  }
111
+ /**
112
+ * Event handler for when dragging state changes.
113
+ * Disables orbit controls during dragging and requests ownership of the transform if it's synchronized.
114
+ * @param event The drag change event
115
+ */
87
116
  onControlChangedEvent = (event) => {
88
117
  const orbit = this.orbit;
89
118
  if (orbit)
@@ -96,6 +125,18 @@ export class TransformGizmo extends Behaviour {
96
125
  }
97
126
  }
98
127
  };
128
+ /**
129
+ * Handles keyboard shortcuts for transform operations:
130
+ * - Q: Toggle local/world space
131
+ * - W: Translation mode
132
+ * - E: Rotation mode
133
+ * - R: Scale mode
134
+ * - Shift: Enable snapping (while held)
135
+ * - +/-: Adjust gizmo size
136
+ * - X/Y/Z: Toggle visibility of respective axis
137
+ * - Spacebar: Toggle controls enabled state
138
+ * @param event The keyboard event
139
+ */
99
140
  windowKeyDownListener = (event) => {
100
141
  if (!this.enabled)
101
142
  return;
@@ -139,6 +180,11 @@ export class TransformGizmo extends Behaviour {
139
180
  break;
140
181
  }
141
182
  };
183
+ /**
184
+ * Handles keyboard key release events.
185
+ * Currently only handles releasing Shift key to disable snapping.
186
+ * @param event The keyboard event
187
+ */
142
188
  windowKeyUpListener = (event) => {
143
189
  if (!this.enabled)
144
190
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"TransformGizmo.js","sourceRoot":"","sources":["../../src/engine-components/TransformGizmo.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAqC,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAErF,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,SAAS;IAGlC,OAAO,GAAY,KAAK,CAAC;IAGzB,eAAe,GAAW,CAAC,CAAC;IAG5B,iBAAiB,GAAW,EAAE,CAAC;IAG/B,SAAS,GAAW,GAAG,CAAC;IAE/B;;;OAGG;IACH,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAEO,QAAQ,CAAqB;IAC7B,KA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Movement } from "./controllers/XRControllerMovement.js";
12
12
  * @group Components
13
13
  */
14
14
  export declare class WebXR extends Behaviour {
15
- /** When enabled a button will be added to the UI to enter VR */
15
+ /**
16
+ * When enabled, a button will be automatically added to {@link NeedleMenu} that allows users to enter VR mode.
17
+ */
16
18
  createVRButton: boolean;
17
- /** When enabled a button will be added to the UI to enter AR */
19
+ /**
20
+ * When enabled, a button will be automatically added to {@link NeedleMenu} that allows users to enter AR mode.
21
+ */
18
22
  createARButton: boolean;
19
- /** When enabled a send to quest button will be shown if the device does not support VR */
23
+ /**
24
+ * When enabled, a button to send the experience to an Oculus Quest will be shown if the current device does not support VR.
25
+ * This helps direct users to compatible devices for optimal VR experiences.
26
+ */
20
27
  createSendToQuestButton: boolean;
21
- /** When enabled a QRCode will be created to open the website on a mobile device */
28
+ /**
29
+ * When enabled, a QR code will be generated and displayed on desktop devices to allow easy opening of the experience on mobile devices.
30
+ */
22
31
  createQRCode: boolean;
23
- /** When enabled default movement behaviour will be added */
32
+ /**
33
+ * When enabled, default movement controls will be automatically added to the scene when entering VR.
34
+ * This includes teleportation and smooth locomotion options for VR controllers.
35
+ */
24
36
  useDefaultControls: boolean;
25
- /** When enabled controller models will automatically be created and updated when you are using controllers in WebXR */
37
+ /**
38
+ * When enabled, 3D models representing the user's VR controllers will be automatically created and rendered in the scene.
39
+ */
26
40
  showControllerModels: boolean;
27
- /** When enabled hand models will automatically be created and updated when you are using hands in WebXR */
41
+ /**
42
+ * When enabled, 3D models representing the user's hands will be automatically created and rendered when hand tracking is available.
43
+ */
28
44
  showHandModels: boolean;
29
- /** When enabled the scene must be placed in AR */
45
+ /**
46
+ * When enabled, a reticle will be displayed to help place the scene in AR. The user must tap on a detected surface to position the scene.
47
+ */
30
48
  usePlacementReticle: boolean;
31
- /** When assigned this object will be used as the AR placement reticle */
49
+ /**
50
+ * Optional custom 3D object to use as the AR placement reticle instead of the default one.
51
+ */
32
52
  customARPlacementReticle?: AssetReference;
33
- /** When enabled you can position, rotate or scale your AR scene with one or two fingers */
53
+ /**
54
+ * When enabled, users can adjust the position, rotation, and scale of the AR scene with one or two fingers after initial placement.
55
+ */
34
56
  usePlacementAdjustment: boolean;
35
- /** Used when `usePlacementReticle` is enabled. This is the scale of the user in the scene in AR. Larger values make the 3D content appear smaller */
57
+ /**
58
+ * Determines the scale of the user relative to the scene in AR. Larger values make the 3D content appear smaller.
59
+ * Only applies when `usePlacementReticle` is enabled.
60
+ */
36
61
  arScale: number;
37
- /** Experimental: When enabled an XRAnchor will be created for the AR scene and the position will be updated to the anchor position every few frames */
62
+ /**
63
+ * When enabled, an XRAnchor will be created for the AR scene and its position will be regularly updated to match the anchor.
64
+ * This can help with spatial persistence in AR experiences.
65
+ * @experimental
66
+ */
38
67
  useXRAnchor: boolean;
39
68
  /**
40
- * When enabled the scene will be placed automatically when a point in the real world is found
69
+ * When enabled, the scene will be automatically placed as soon as a suitable surface is detected in AR,
70
+ * without requiring the user to tap to confirm placement.
41
71
  */
42
72
  autoPlace: boolean;
43
- /** When enabled the AR session root center will be automatically adjusted to place the center of the scene */
73
+ /**
74
+ * When enabled, the AR session root center will be automatically adjusted to place the center of the scene.
75
+ * This helps ensure the scene is properly aligned with detected surfaces.
76
+ */
44
77
  autoCenter: boolean;
45
- /** When enabled a USDZExporter component will be added to the scene (if none is found) */
78
+ /**
79
+ * When enabled, a USDZExporter component will be automatically added to the scene if none is found.
80
+ * This allows iOS and visionOS devices to view 3D content using Apple's AR QuickLook.
81
+ */
46
82
  useQuicklookExport: boolean;
47
- /** Preview feature enabling occlusion (when available: https://github.com/cabanier/three.js/commit/b6ee92bcd8f20718c186120b7f19a3b68a1d4e47)
48
- * Enables the 'depth-sensing' WebXR feature to provide realtime depth occlusion. Only supported on Oculus Quest right now.
83
+ /**
84
+ * When enabled, the 'depth-sensing' WebXR feature will be requested to provide real-time depth occlusion.
85
+ * Currently only supported on Oculus Quest devices.
86
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/XRDepthInformation
87
+ * @experimental
49
88
  */
50
89
  useDepthSensing: boolean;
51
90
  /**
52
- * When enabled the spatial grab raycaster will be added or enabled in the scene
91
+ * When enabled, a {@link SpatialGrabRaycaster} will be added or enabled in the scene,
92
+ * allowing users to interact with objects at a distance in VR/AR.
53
93
  * @default true
54
94
  */
55
95
  useSpatialGrab: boolean;
56
- /** This avatar representation will be spawned when you enter a webxr session */
96
+ /**
97
+ * Specifies the avatar representation that will be created when entering a WebXR session.
98
+ * Can be a reference to a 3D model or a boolean to use the default avatar.
99
+ */
57
100
  defaultAvatar?: AssetReference | boolean;
58
101
  private _playerSync?;
59
102
  /** these components were created by the WebXR component on session start and will be cleaned up again in session end */
60
103
  private readonly _createdComponentsInSession;
61
104
  private _usdzExporter?;
62
105
  static activeWebXRComponent: WebXR | null;
106
+ /**
107
+ * Initializes the WebXR component by obtaining the XR sync object for this context.
108
+ */
63
109
  awake(): void;
110
+ /**
111
+ * Sets up the WebXR component when it's enabled. Checks for HTTPS connection,
112
+ * sets up USDZ export if enabled, creates UI buttons, and configures avatar settings.
113
+ */
64
114
  onEnable(): void;
115
+ /**
116
+ * Cleans up resources when the component is disabled.
117
+ * Destroys the USDZ exporter if one was created and removes UI buttons.
118
+ */
65
119
  onDisable(): void;
120
+ /**
121
+ * Checks if WebXR is supported and offers an appropriate session.
122
+ * This is used to show the WebXR session joining prompt in browsers that support it.
123
+ * @returns A Promise that resolves to true if a session was offered, false otherwise
124
+ */
66
125
  private handleOfferSession;
67
126
  /** the currently active webxr input session */
68
127
  get session(): NeedleXRSession | null;
@@ -78,24 +137,74 @@ export declare class WebXR extends Behaviour {
78
137
  private _previousXRState;
79
138
  private _spatialGrabRaycaster?;
80
139
  private get isActiveWebXR();
140
+ /**
141
+ * Called before entering a WebXR session. Sets up optional features like depth sensing, if needed.
142
+ * @param _mode The XR session mode being requested (immersive-ar or immersive-vr)
143
+ * @param args The XRSessionInit object that will be passed to the WebXR API
144
+ */
81
145
  onBeforeXR(_mode: XRSessionMode, args: XRSessionInit): void;
146
+ /**
147
+ * Called when a WebXR session begins. Sets up the scene for XR by configuring controllers,
148
+ * AR placement, and other features based on component settings.
149
+ * @param args Event arguments containing information about the started XR session
150
+ */
82
151
  onEnterXR(args: NeedleXREventArgs): Promise<void>;
152
+ /**
153
+ * Called every frame during an active WebXR session.
154
+ * Updates components that depend on the current XR state.
155
+ * @param _args Event arguments containing information about the current XR session frame
156
+ */
83
157
  onUpdateXR(_args: NeedleXREventArgs): void;
158
+ /**
159
+ * Called when a WebXR session ends. Restores pre-session state,
160
+ * removes temporary components, and cleans up resources.
161
+ * @param _ Event arguments containing information about the ended XR session
162
+ */
84
163
  onLeaveXR(_: NeedleXREventArgs): void;
85
164
  /** Call to enable or disable default controller behaviour */
86
165
  setDefaultMovementEnabled(enabled: boolean): XRControllerMovement | null;
87
166
  /** Call to enable or disable default controller rendering */
88
167
  setDefaultControllerRenderingEnabled(enabled: boolean): XRControllerModel | null;
168
+ /**
169
+ * Creates and instantiates the user's avatar representation in the WebXR session.
170
+ * @param xr The active session
171
+ */
89
172
  protected createLocalAvatar(xr: NeedleXRSession): Promise<void>;
173
+ /**
174
+ * Event handler called when a player avatar is spawned.
175
+ * Ensures the avatar has the necessary Avatar component.
176
+ * @param instance The spawned avatar 3D object
177
+ */
90
178
  private onAvatarSpawned;
91
- /** @deprecated use `getButtonsFactory()` or access `WebXRButtonFactory.getOrCreate()` directory */
179
+ /** @deprecated use {@link getButtonsFactory} or directly access {@link WebXRButtonFactory.getOrCreate} */
92
180
  getButtonsContainer(): WebXRButtonFactory;
93
- /** Calling this function will get the Needle WebXR button factory (it will be created if it doesnt exist yet)
94
- * @returns the Needle WebXR button factory */
181
+ /**
182
+ * Returns the WebXR button factory, creating one if it doesn't exist.
183
+ * Use this to access and modify WebXR UI buttons.
184
+ * @returns The WebXRButtonFactory instance
185
+ */
95
186
  getButtonsFactory(): WebXRButtonFactory;
187
+ /**
188
+ * Reference to the WebXR button factory used by this component.
189
+ */
96
190
  private _buttonFactory?;
191
+ /**
192
+ * Creates and sets up UI elements for WebXR interaction based on component settings
193
+ * and device capabilities. Handles creating AR, VR, QuickLook buttons and utility buttons like QR codes.
194
+ */
97
195
  private handleCreatingHTML;
196
+ /**
197
+ * Storage for UI buttons created by this component.
198
+ */
98
199
  private readonly _buttons;
200
+ /**
201
+ * Adds a button to the UI with the specified priority.
202
+ * @param button The HTML element to add
203
+ * @param priority The button's priority value (lower numbers appear first)
204
+ */
99
205
  private addButton;
206
+ /**
207
+ * Removes all buttons created by this component from the UI.
208
+ */
100
209
  private removeButtons;
101
210
  }