@needle-tools/engine 5.1.6 → 5.1.8

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 (71) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/components.needle.json +1 -1
  3. package/dist/{needle-engine.bundle-BcyvM7a6.js → needle-engine.bundle-CaD5rOJ0.js} +4839 -4791
  4. package/dist/{needle-engine.bundle-FRzWLdVf.umd.cjs → needle-engine.bundle-D8gP8Nd0.umd.cjs} +140 -140
  5. package/dist/{needle-engine.bundle-CadxfFMM.min.js → needle-engine.bundle-X7Y4A-EO.min.js} +140 -140
  6. package/dist/needle-engine.d.ts +72 -24
  7. package/dist/needle-engine.js +266 -266
  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.js +6 -0
  21. package/lib/engine/engine_utils.js.map +1 -1
  22. package/lib/engine/engine_utils_qrcode.js +2 -2
  23. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  24. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  25. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  26. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  27. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  28. package/lib/engine/webcomponents/needle-engine.js +2 -2
  29. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  30. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  31. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  32. package/lib/engine/xr/NeedleXRSession.js +20 -2
  33. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  34. package/lib/engine/xr/TempXRContext.js +2 -2
  35. package/lib/engine/xr/TempXRContext.js.map +1 -1
  36. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  37. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  38. package/lib/engine-components/webxr/TeleportTarget.d.ts +21 -8
  39. package/lib/engine-components/webxr/TeleportTarget.js +21 -8
  40. package/lib/engine-components/webxr/TeleportTarget.js.map +1 -1
  41. package/lib/engine-components/webxr/WebARSessionRoot.d.ts +24 -6
  42. package/lib/engine-components/webxr/WebARSessionRoot.js +130 -39
  43. package/lib/engine-components/webxr/WebARSessionRoot.js.map +1 -1
  44. package/lib/engine-components/webxr/WebXR.d.ts +3 -3
  45. package/lib/engine-components/webxr/WebXR.js +4 -4
  46. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  47. package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +18 -1
  48. package/lib/engine-components/webxr/controllers/XRControllerMovement.js +18 -1
  49. package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
  50. package/package.json +1 -1
  51. package/plugins/common/license.js +23 -5
  52. package/plugins/vite/dependencies.js +34 -0
  53. package/plugins/vite/license.js +4 -4
  54. package/plugins/vite/needle-app.js +13 -0
  55. package/src/engine/api.ts +1 -1
  56. package/src/engine/engine_init.ts +2 -2
  57. package/src/engine/engine_license.ts +68 -68
  58. package/src/engine/engine_networking_blob.ts +3 -3
  59. package/src/engine/engine_utils.ts +4 -0
  60. package/src/engine/engine_utils_qrcode.ts +2 -2
  61. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  62. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  63. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  64. package/src/engine/webcomponents/needle-engine.ts +2 -2
  65. package/src/engine/xr/NeedleXRSession.ts +19 -2
  66. package/src/engine/xr/TempXRContext.ts +2 -2
  67. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  68. package/src/engine-components/webxr/TeleportTarget.ts +23 -10
  69. package/src/engine-components/webxr/WebARSessionRoot.ts +124 -38
  70. package/src/engine-components/webxr/WebXR.ts +4 -4
  71. package/src/engine-components/webxr/controllers/XRControllerMovement.ts +20 -3
@@ -118,13 +118,13 @@ export declare const $componentName: unique symbol;
118
118
 
119
119
  export declare const $physicsKey: unique symbol;
120
120
 
121
- /* Excluded from this release type: _$SVo */
122
-
123
121
  export declare class __Ignore {
124
122
  }
125
123
 
126
124
  export declare function __internalNotifyObjectDestroyed(obj: Object3D): void;
127
125
 
126
+ /* Excluded from this release type: __sKHtRdk */
127
+
128
128
  /** Data describing the accessible semantics for a 3D object or component. */
129
129
  declare type AccessibilityData = {
130
130
  /** ARIA role (e.g. `"button"`, `"img"`, `"region"`). */
@@ -11155,6 +11155,8 @@ declare class LowPassFilter {
11155
11155
  reset(value?: number): void;
11156
11156
  }
11157
11157
 
11158
+ /* Excluded from this release type: LuMYUbW */
11159
+
11158
11160
  declare type MagicSkyboxName = "studio" | "blurred-skybox" | "quicklook-ar" | "quicklook";
11159
11161
 
11160
11162
  export declare class MainModule {
@@ -18040,8 +18042,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
18040
18042
  evaluate(t01: number, t: number): number;
18041
18043
  }
18042
18044
 
18043
- /* Excluded from this release type: _RTmnPEj */
18044
-
18045
18045
  export declare function sanitizeString(str: any): string;
18046
18046
 
18047
18047
  /** Download a image (must be a data url).
@@ -21475,23 +21475,36 @@ export declare class OrbitControls extends Component implements ICameraControlle
21475
21475
  * Marks a GameObject as a valid teleportation target for VR locomotion.
21476
21476
  * Add this component to objects or surfaces where users should be able to teleport.
21477
21477
  *
21478
- * **Usage:**
21479
- * - Add to floor surfaces, platforms, or designated teleport spots
21480
- * - Works with {@link XRControllerMovement} component's teleport system
21481
- * - Can be used to restrict teleportation to specific areas
21478
+ * **How targeting works (important):**
21479
+ * The teleport ray uses a **visual raycast against rendered meshes** — NOT physics colliders.
21480
+ * When {@link XRControllerMovement.useTeleportTarget} is enabled, the controller ray is cast
21481
+ * against the rendered scene and the hit object (or any of its parents) is checked for a
21482
+ * `TeleportTarget` component. You can only teleport onto an object if that object, or one of
21483
+ * its ancestors, has this component.
21484
+ *
21485
+ * **Requirements for a target to be hittable:**
21486
+ * - It MUST have a visible, rendered mesh (a `MeshRenderer` / geometry). The ray hits the
21487
+ * rendered geometry directly.
21488
+ * - **A collider is NOT required.** Teleport does not use physics colliders — adding a
21489
+ * `BoxCollider` (or any collider) has no effect on whether the target can be teleported to.
21490
+ * - It must NOT be on the IgnoreRaycast layer (three.js layer 2) and must not have
21491
+ * `raycastAllowed` / `visible` set to false, otherwise the ray skips it.
21492
+ * - The `TeleportTarget` component may be on the hit mesh itself or on any parent
21493
+ * (resolved via `getComponentInParent`).
21482
21494
  *
21483
21495
  * **Setup:**
21484
- * 1. Add this component to GameObjects that should be teleport destinations
21485
- * 2. Configure {@link XRControllerMovement} to use teleport targets (optional)
21496
+ * 1. Add this component to GameObjects (with a visible mesh) that should be teleport destinations
21497
+ * 2. Enable "Use Teleport Target" on the {@link XRControllerMovement} component so teleporting
21498
+ * is restricted to objects carrying this component
21486
21499
  * 3. Test teleportation in VR mode
21487
21500
  *
21488
21501
  * @example
21489
21502
  * ```ts
21490
- * // Make a platform teleportable
21503
+ * // Make a platform teleportable (the platform already has a visible mesh)
21491
21504
  * const platform = myPlatform.addComponent(TeleportTarget);
21492
21505
  * ```
21493
21506
  *
21494
- * @summary Marker component for valid VR teleportation destinations
21507
+ * @summary Marker component for valid VR teleportation destinations (mesh hit-test, no collider needed)
21495
21508
  * @category XR
21496
21509
  * @group Components
21497
21510
  * @see {@link XRControllerMovement} for VR locomotion and teleport configuration
@@ -23538,6 +23551,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
23538
23551
  private updateDarkness;
23539
23552
  }
23540
23553
 
23554
+ /* Excluded from this release type: _VIq */
23555
+
23541
23556
  /**
23542
23557
  * Action to show or hide an object.
23543
23558
  * Use together with a {@link TapGestureTrigger} to show or hide objects when tapped or clicked.
@@ -23982,9 +23997,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
23982
23997
  autoPlace: boolean;
23983
23998
  /** When enabled the scene center will be automatically calculated from the content in the scene */
23984
23999
  autoCenter: boolean;
23985
- /** Experimental: When enabled we will create a XR anchor for the scene placement
23986
- * and make sure the scene is at that anchored point during a XR session
23987
- * @default false
24000
+ /** When enabled a XR anchor is created at the scene placement position and the scene
24001
+ * stays at that anchored point while tracking refines during the XR session.
24002
+ * On platforms without WebXR anchor support this gracefully falls back to plain placement.
24003
+ * @default true
23988
24004
  **/
23989
24005
  useXRAnchor: boolean;
23990
24006
  /** true if we're currently placing the scene */
@@ -23998,12 +24014,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
23998
24014
  private readonly _placementScene;
23999
24015
  /** the reticles used for placement */
24000
24016
  private readonly _reticle;
24001
- /** needs to be in sync with the reticles */
24002
- private readonly _hits;
24017
+ /** reference-space hit poses, in sync with the reticles — captured while placing when {@link useXRAnchor}
24018
+ * is enabled, because hit test results can not be used outside the animation frame that produced them */
24019
+ private readonly _hitRefPoses;
24003
24020
  private _placementStartTime;
24004
24021
  private _rigPlacementMatrix?;
24005
24022
  /** if useAnchor is enabled this is the anchor we have created on placing the scene using the placement hit */
24006
24023
  private _anchor;
24024
+ /** the placement pose (reference space) waiting for anchor creation on the next animation frame */
24025
+ private _pendingAnchorPose;
24026
+ /** the last anchor pose (in rig space) that has been applied to the rig */
24027
+ private readonly _anchorLastLocalPose;
24007
24028
  /** user input is used for ar touch transform */
24008
24029
  private userInput?;
24009
24030
  onEnable(): void;
@@ -24015,7 +24036,19 @@ export declare class OrbitControls extends Component implements ICameraControlle
24015
24036
  private onPlaceScene;
24016
24037
  private onSetScale;
24017
24038
  private onRevertSceneChanges;
24018
- private onCreateAnchor;
24039
+ /**
24040
+ * Deferred anchor creation and per-frame anchor tracking. Called from {@link onUpdateXR} after the scene has been placed.
24041
+ *
24042
+ * Creation can not happen during placement: `XRHitTestResult.createAnchor` only works while the animation
24043
+ * frame that produced the hit is active, and placement runs from an input event where that frame is already
24044
+ * over (`XRFrame.createAnchor` equally requires an active animation frame). So {@link onPlaceScene} only
24045
+ * records the reference-space pose and the anchor is created here, on the next animation frame.
24046
+ *
24047
+ * Once the anchor exists, its pose *changes* (delta in rig space) are applied to the XR rig: the world pose
24048
+ * of the anchored point stays constant while tracking refines, without discarding other rig modifications
24049
+ * ({@link arTouchTransform} user adjustments, {@link arScale}).
24050
+ */
24051
+ private updateXRAnchor;
24019
24052
  private upVec;
24020
24053
  private lookPoint;
24021
24054
  private worldUpVec;
@@ -24129,9 +24162,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
24129
24162
  */
24130
24163
  arScale: number;
24131
24164
  /**
24132
- * When enabled, an XRAnchor will be created for the AR scene and its position will be regularly updated to match the anchor.
24133
- * This can help with spatial persistence in AR experiences.
24134
- * @experimental
24165
+ * When enabled, an XRAnchor is created at the AR placement position and the scene stays glued to it while tracking refines.
24166
+ * On platforms without WebXR anchor support this gracefully falls back to plain placement.
24167
+ * @default true
24135
24168
  */
24136
24169
  useXRAnchor: boolean;
24137
24170
  /**
@@ -24808,8 +24841,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
24808
24841
  constructor(context: WebXRImageTracking, trackedImage: WebXRImageTrackingModel, bitmap: ImageBitmap, measuredSize: number, state: "tracked" | "emulated", pose: any);
24809
24842
  }
24810
24843
 
24811
- /* Excluded from this release type: _wHm */
24812
-
24813
24844
  export declare type WriteCallback = (data: any, prop: string) => void;
24814
24845
 
24815
24846
  /** Button names as used in the xr profile */
@@ -24922,6 +24953,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
24922
24953
  * 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).
24923
24954
  * It also visualizes controller rays and hit points in the scene.
24924
24955
  *
24956
+ * The component operates on the active XR rig and controllers from the {@link NeedleXRSession} (`args.xr.rig`,
24957
+ * `args.xr.leftController` / `rightController`) and receives `onUpdateXR` regardless of where it sits in the hierarchy.
24958
+ * It does NOT need to be on the same GameObject as {@link WebXR}, and does not read {@link WebXR} from its parents.
24959
+ *
24960
+ * **Duplicate-handler gotcha:** {@link WebXR.setDefaultMovementEnabled} (called when `WebXR.useDefaultControls` is enabled,
24961
+ * the default) adds an `XRControllerMovement` to the WebXR GameObject only if that object has none. If you place your own
24962
+ * `XRControllerMovement` on a different object, WebXR still adds a second, default one at runtime — two handlers then run
24963
+ * simultaneously (doubled movement, and your teleport settings such as {@link XRControllerMovement.useTeleportTarget} are
24964
+ * bypassed by the default handler). Put your component on the WebXR GameObject, or disable `WebXR.useDefaultControls`.
24925
24965
  *
24926
24966
  * @summary Move the XR rig using controller input
24927
24967
  * @category XR
@@ -24945,7 +24985,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
24945
24985
  * @default true
24946
24986
  */
24947
24987
  usePinchToTeleport: boolean;
24948
- /** Enable to only allow teleporting on objects with a TeleportTarget component (see {@link TeleportTarget})
24988
+ /** Enable to only allow teleporting on objects with a {@link TeleportTarget} component.
24989
+ *
24990
+ * The teleport ray is a **visual raycast against rendered meshes** (not physics colliders):
24991
+ * it hits the rendered geometry and then looks for a {@link TeleportTarget} on the hit object
24992
+ * or any of its parents. A collider is NOT required on the target — only a visible mesh that
24993
+ * is not on the IgnoreRaycast layer.
24994
+ *
24995
+ * When enabled, teleporting is rejected if the ray does not hit a `TeleportTarget` (the
24996
+ * ground-plane fallback used in free teleport mode is also disabled).
24949
24997
  * @default false
24950
24998
  */
24951
24999
  useTeleportTarget: boolean;