@needle-tools/engine 5.1.7 → 5.1.8-next.1784885350.large-bamboo.746608e

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 (70) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/components.needle.json +1 -1
  3. package/dist/{needle-engine.bundle-DlX4Rcl_.min.js → needle-engine.bundle-Cw8tbJuS.min.js} +133 -133
  4. package/dist/{needle-engine.bundle-DT6F1AXh.js → needle-engine.bundle-bOImzZkB.js} +3895 -3880
  5. package/dist/{needle-engine.bundle-1QN--joB.umd.cjs → needle-engine.bundle-uEyfssJk.umd.cjs} +135 -135
  6. package/dist/needle-engine.d.ts +49 -18
  7. package/dist/needle-engine.js +334 -334
  8. package/dist/needle-engine.min.js +1 -1
  9. package/dist/needle-engine.umd.cjs +1 -1
  10. package/lib/engine/api.d.ts +1 -1
  11. package/lib/engine/api.js +1 -1
  12. package/lib/engine/api.js.map +1 -1
  13. package/lib/engine/engine_init.js +2 -2
  14. package/lib/engine/engine_init.js.map +1 -1
  15. package/lib/engine/engine_license.d.ts +7 -7
  16. package/lib/engine/engine_license.js +71 -71
  17. package/lib/engine/engine_license.js.map +1 -1
  18. package/lib/engine/engine_networking_blob.js +3 -3
  19. package/lib/engine/engine_networking_blob.js.map +1 -1
  20. package/lib/engine/engine_utils_qrcode.js +2 -2
  21. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  22. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  23. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  24. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  25. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  26. package/lib/engine/webcomponents/needle-engine.js +2 -2
  27. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  28. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  29. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  30. package/lib/engine/xr/NeedleXRSession.d.ts +2 -2
  31. package/lib/engine/xr/NeedleXRSession.js +9 -1
  32. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  33. package/lib/engine/xr/TempXRContext.js +2 -2
  34. package/lib/engine/xr/TempXRContext.js.map +1 -1
  35. package/lib/engine-components/Component.d.ts +2 -1
  36. package/lib/engine-components/Component.js.map +1 -1
  37. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  38. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  39. package/lib/engine-components/webxr/TeleportTarget.d.ts +21 -8
  40. package/lib/engine-components/webxr/TeleportTarget.js +21 -8
  41. package/lib/engine-components/webxr/TeleportTarget.js.map +1 -1
  42. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +1 -1
  43. package/lib/engine-components/webxr/WebXRImageTracking.js +19 -48
  44. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  45. package/lib/engine-components/webxr/WebXRImageTracking.utils.d.ts +35 -0
  46. package/lib/engine-components/webxr/WebXRImageTracking.utils.js +96 -0
  47. package/lib/engine-components/webxr/WebXRImageTracking.utils.js.map +1 -0
  48. package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +18 -1
  49. package/lib/engine-components/webxr/controllers/XRControllerMovement.js +18 -1
  50. package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
  51. package/package.json +1 -1
  52. package/plugins/common/license.js +4 -4
  53. package/plugins/vite/license.js +4 -4
  54. package/src/engine/api.ts +1 -1
  55. package/src/engine/engine_init.ts +2 -2
  56. package/src/engine/engine_license.ts +68 -68
  57. package/src/engine/engine_networking_blob.ts +3 -3
  58. package/src/engine/engine_utils_qrcode.ts +2 -2
  59. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  60. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  61. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  62. package/src/engine/webcomponents/needle-engine.ts +2 -2
  63. package/src/engine/xr/NeedleXRSession.ts +11 -3
  64. package/src/engine/xr/TempXRContext.ts +2 -2
  65. package/src/engine-components/Component.ts +2 -1
  66. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  67. package/src/engine-components/webxr/TeleportTarget.ts +23 -10
  68. package/src/engine-components/webxr/WebXRImageTracking.ts +19 -51
  69. package/src/engine-components/webxr/WebXRImageTracking.utils.ts +105 -0
  70. package/src/engine-components/webxr/controllers/XRControllerMovement.ts +20 -3
@@ -114,9 +114,9 @@ import { XRControllerModelFactory } from 'three/examples/jsm/webxr/XRControllerM
114
114
  import { XRHandMeshModel } from 'three/examples/jsm/webxr/XRHandMeshModel.js';
115
115
  import { XRHandSpace } from 'three';
116
116
 
117
- export declare const $componentName: unique symbol;
117
+ /* Excluded from this release type: _$BbU */
118
118
 
119
- /* Excluded from this release type: _$lAjTeY */
119
+ export declare const $componentName: unique symbol;
120
120
 
121
121
  export declare const $physicsKey: unique symbol;
122
122
 
@@ -4119,8 +4119,9 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
4119
4119
  * Use to modify session initialization parameters
4120
4120
  * @param mode The XR session mode being requested
4121
4121
  * @param args The session initialization parameters that can be modified
4122
+ * @returns void, or a promise that is awaited before the session is requested (e.g. to load assets)
4122
4123
  */
4123
- onBeforeXR?(mode: XRSessionMode, args: XRSessionInit): void;
4124
+ onBeforeXR?(mode: XRSessionMode, args: XRSessionInit): void | Promise<void>;
4124
4125
  /**
4125
4126
  * Called when this component joins an XR session or becomes active in a running session
4126
4127
  * @param args Event data for the XR session
@@ -5805,6 +5806,8 @@ export declare class DocumentExtension implements IUSDExporterExtension {
5805
5806
  onAfterBuildDocument(_context: any): void;
5806
5807
  }
5807
5808
 
5809
+ /* Excluded from this release type: DpVN */
5810
+
5808
5811
  /**
5809
5812
  * [DragControls](https://engine.needle.tools/docs/api/DragControls) enables interactive dragging of objects in 2D (screen space) or 3D (world space).
5810
5813
  *
@@ -6376,8 +6379,6 @@ export declare class EnvironmentScene extends Scene {
6376
6379
  createAreaLightMaterial(intensity: number): MeshBasicMaterial;
6377
6380
  }
6378
6381
 
6379
- /* Excluded from this release type: _ERXbX */
6380
-
6381
6382
  /** An Euler value, either as a Three.js Euler or as a `[x, y, z]` tuple (radians) */
6382
6383
  declare type EulerValue = Euler | [number, number, number];
6383
6384
 
@@ -9054,8 +9055,8 @@ export declare type INeedleXRSession = NeedleXRSession;
9054
9055
  export declare interface INeedleXRSessionEventReceiver extends Pick<IComponent, "destroyed"> {
9055
9056
  get activeAndEnabled(): boolean;
9056
9057
  supportsXR?(mode: XRSessionMode): boolean;
9057
- /** Called before requesting a XR session */
9058
- onBeforeXR?(mode: XRSessionMode, args: XRSessionInit): void;
9058
+ /** Called before requesting a XR session. May return a promise that is awaited before requesting. */
9059
+ onBeforeXR?(mode: XRSessionMode, args: XRSessionInit): void | Promise<void>;
9059
9060
  onEnterXR?(args: NeedleXREventArgs): void;
9060
9061
  onUpdateXR?(args: NeedleXREventArgs): void;
9061
9062
  onLeaveXR?(args: NeedleXREventArgs): void;
@@ -14747,8 +14748,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
14747
14748
  effectDistance?: Vector2;
14748
14749
  }
14749
14750
 
14750
- /* Excluded from this release type: _owM */
14751
-
14752
14751
  /** The Needle Engine networking server supports the concept of ownership that can be requested.
14753
14752
  * This enum contains possible outgoing (Request*) and incoming (Response*) events for communicating ownership.
14754
14753
  *
@@ -21477,23 +21476,36 @@ export declare class OrbitControls extends Component implements ICameraControlle
21477
21476
  * Marks a GameObject as a valid teleportation target for VR locomotion.
21478
21477
  * Add this component to objects or surfaces where users should be able to teleport.
21479
21478
  *
21480
- * **Usage:**
21481
- * - Add to floor surfaces, platforms, or designated teleport spots
21482
- * - Works with {@link XRControllerMovement} component's teleport system
21483
- * - Can be used to restrict teleportation to specific areas
21479
+ * **How targeting works (important):**
21480
+ * The teleport ray uses a **visual raycast against rendered meshes** — NOT physics colliders.
21481
+ * When {@link XRControllerMovement.useTeleportTarget} is enabled, the controller ray is cast
21482
+ * against the rendered scene and the hit object (or any of its parents) is checked for a
21483
+ * `TeleportTarget` component. You can only teleport onto an object if that object, or one of
21484
+ * its ancestors, has this component.
21485
+ *
21486
+ * **Requirements for a target to be hittable:**
21487
+ * - It MUST have a visible, rendered mesh (a `MeshRenderer` / geometry). The ray hits the
21488
+ * rendered geometry directly.
21489
+ * - **A collider is NOT required.** Teleport does not use physics colliders — adding a
21490
+ * `BoxCollider` (or any collider) has no effect on whether the target can be teleported to.
21491
+ * - It must NOT be on the IgnoreRaycast layer (three.js layer 2) and must not have
21492
+ * `raycastAllowed` / `visible` set to false, otherwise the ray skips it.
21493
+ * - The `TeleportTarget` component may be on the hit mesh itself or on any parent
21494
+ * (resolved via `getComponentInParent`).
21484
21495
  *
21485
21496
  * **Setup:**
21486
- * 1. Add this component to GameObjects that should be teleport destinations
21487
- * 2. Configure {@link XRControllerMovement} to use teleport targets (optional)
21497
+ * 1. Add this component to GameObjects (with a visible mesh) that should be teleport destinations
21498
+ * 2. Enable "Use Teleport Target" on the {@link XRControllerMovement} component so teleporting
21499
+ * is restricted to objects carrying this component
21488
21500
  * 3. Test teleportation in VR mode
21489
21501
  *
21490
21502
  * @example
21491
21503
  * ```ts
21492
- * // Make a platform teleportable
21504
+ * // Make a platform teleportable (the platform already has a visible mesh)
21493
21505
  * const platform = myPlatform.addComponent(TeleportTarget);
21494
21506
  * ```
21495
21507
  *
21496
- * @summary Marker component for valid VR teleportation destinations
21508
+ * @summary Marker component for valid VR teleportation destinations (mesh hit-test, no collider needed)
21497
21509
  * @category XR
21498
21510
  * @group Components
21499
21511
  * @see {@link XRControllerMovement} for VR locomotion and teleport configuration
@@ -24830,6 +24842,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
24830
24842
 
24831
24843
  export declare type WriteCallback = (data: any, prop: string) => void;
24832
24844
 
24845
+ /* Excluded from this release type: _WXkIc */
24846
+
24833
24847
  /** Button names as used in the xr profile */
24834
24848
  export declare type XRControllerButtonName = "thumbrest" | "xr-standard-trigger" | "xr-standard-squeeze" | "xr-standard-thumbstick" | "xr-standard-touchpad" | "menu" | GamepadButtonName | StylusButtonName;
24835
24849
 
@@ -24940,6 +24954,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
24940
24954
  * Additionally it supports teleporting using the right controller's thumbstick or by pinching the index finger tip in front of the hand (if hand tracking is enabled).
24941
24955
  * It also visualizes controller rays and hit points in the scene.
24942
24956
  *
24957
+ * The component operates on the active XR rig and controllers from the {@link NeedleXRSession} (`args.xr.rig`,
24958
+ * `args.xr.leftController` / `rightController`) and receives `onUpdateXR` regardless of where it sits in the hierarchy.
24959
+ * It does NOT need to be on the same GameObject as {@link WebXR}, and does not read {@link WebXR} from its parents.
24960
+ *
24961
+ * **Duplicate-handler gotcha:** {@link WebXR.setDefaultMovementEnabled} (called when `WebXR.useDefaultControls` is enabled,
24962
+ * the default) adds an `XRControllerMovement` to the WebXR GameObject only if that object has none. If you place your own
24963
+ * `XRControllerMovement` on a different object, WebXR still adds a second, default one at runtime — two handlers then run
24964
+ * simultaneously (doubled movement, and your teleport settings such as {@link XRControllerMovement.useTeleportTarget} are
24965
+ * bypassed by the default handler). Put your component on the WebXR GameObject, or disable `WebXR.useDefaultControls`.
24943
24966
  *
24944
24967
  * @summary Move the XR rig using controller input
24945
24968
  * @category XR
@@ -24963,7 +24986,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
24963
24986
  * @default true
24964
24987
  */
24965
24988
  usePinchToTeleport: boolean;
24966
- /** Enable to only allow teleporting on objects with a TeleportTarget component (see {@link TeleportTarget})
24989
+ /** Enable to only allow teleporting on objects with a {@link TeleportTarget} component.
24990
+ *
24991
+ * The teleport ray is a **visual raycast against rendered meshes** (not physics colliders):
24992
+ * it hits the rendered geometry and then looks for a {@link TeleportTarget} on the hit object
24993
+ * or any of its parents. A collider is NOT required on the target — only a visible mesh that
24994
+ * is not on the IgnoreRaycast layer.
24995
+ *
24996
+ * When enabled, teleporting is rejected if the ray does not hit a `TeleportTarget` (the
24997
+ * ground-plane fallback used in free teleport mode is also disabled).
24967
24998
  * @default false
24968
24999
  */
24969
25000
  useTeleportTarget: boolean;