@needle-tools/engine 5.1.6 → 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.
- package/CHANGELOG.md +10 -0
- package/components.needle.json +1 -1
- package/dist/{needle-engine.bundle-CadxfFMM.min.js → needle-engine.bundle-Cw8tbJuS.min.js} +142 -142
- package/dist/{needle-engine.bundle-BcyvM7a6.js → needle-engine.bundle-bOImzZkB.js} +5147 -5084
- package/dist/{needle-engine.bundle-FRzWLdVf.umd.cjs → needle-engine.bundle-uEyfssJk.umd.cjs} +141 -141
- package/dist/needle-engine.d.ts +76 -27
- package/dist/needle-engine.js +326 -326
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/api.d.ts +1 -1
- package/lib/engine/api.js +1 -1
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_init.js +2 -2
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_license.d.ts +7 -7
- package/lib/engine/engine_license.js +71 -71
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +3 -3
- package/lib/engine/engine_utils.js +6 -0
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +2 -2
- package/lib/engine/xr/NeedleXRSession.js +29 -3
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine-components/Component.d.ts +2 -1
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/webxr/TeleportTarget.d.ts +21 -8
- package/lib/engine-components/webxr/TeleportTarget.js +21 -8
- package/lib/engine-components/webxr/TeleportTarget.js.map +1 -1
- package/lib/engine-components/webxr/WebARSessionRoot.d.ts +24 -6
- package/lib/engine-components/webxr/WebARSessionRoot.js +130 -39
- package/lib/engine-components/webxr/WebARSessionRoot.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +3 -3
- package/lib/engine-components/webxr/WebXR.js +4 -4
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.js +19 -48
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.utils.d.ts +35 -0
- package/lib/engine-components/webxr/WebXRImageTracking.utils.js +96 -0
- package/lib/engine-components/webxr/WebXRImageTracking.utils.js.map +1 -0
- package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +18 -1
- package/lib/engine-components/webxr/controllers/XRControllerMovement.js +18 -1
- package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
- package/package.json +1 -1
- package/plugins/common/license.js +23 -5
- package/plugins/vite/dependencies.js +34 -0
- package/plugins/vite/license.js +4 -4
- package/plugins/vite/needle-app.js +13 -0
- package/src/engine/api.ts +1 -1
- package/src/engine/engine_init.ts +2 -2
- package/src/engine/engine_license.ts +68 -68
- package/src/engine/engine_networking_blob.ts +3 -3
- package/src/engine/engine_utils.ts +4 -0
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +2 -2
- package/src/engine/xr/NeedleXRSession.ts +30 -5
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine-components/Component.ts +2 -1
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/webxr/TeleportTarget.ts +23 -10
- package/src/engine-components/webxr/WebARSessionRoot.ts +124 -38
- package/src/engine-components/webxr/WebXR.ts +4 -4
- package/src/engine-components/webxr/WebXRImageTracking.ts +19 -51
- package/src/engine-components/webxr/WebXRImageTracking.utils.ts +105 -0
- package/src/engine-components/webxr/controllers/XRControllerMovement.ts +20 -3
package/dist/needle-engine.d.ts
CHANGED
|
@@ -114,12 +114,12 @@ 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
|
+
/* Excluded from this release type: _$BbU */
|
|
118
|
+
|
|
117
119
|
export declare const $componentName: unique symbol;
|
|
118
120
|
|
|
119
121
|
export declare const $physicsKey: unique symbol;
|
|
120
122
|
|
|
121
|
-
/* Excluded from this release type: _$SVo */
|
|
122
|
-
|
|
123
123
|
export declare class __Ignore {
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -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
|
*
|
|
@@ -9052,8 +9055,8 @@ export declare type INeedleXRSession = NeedleXRSession;
|
|
|
9052
9055
|
export declare interface INeedleXRSessionEventReceiver extends Pick<IComponent, "destroyed"> {
|
|
9053
9056
|
get activeAndEnabled(): boolean;
|
|
9054
9057
|
supportsXR?(mode: XRSessionMode): boolean;
|
|
9055
|
-
/** Called before requesting a XR session */
|
|
9056
|
-
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>;
|
|
9057
9060
|
onEnterXR?(args: NeedleXREventArgs): void;
|
|
9058
9061
|
onUpdateXR?(args: NeedleXREventArgs): void;
|
|
9059
9062
|
onLeaveXR?(args: NeedleXREventArgs): void;
|
|
@@ -18040,8 +18043,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18040
18043
|
evaluate(t01: number, t: number): number;
|
|
18041
18044
|
}
|
|
18042
18045
|
|
|
18043
|
-
/* Excluded from this release type: _RTmnPEj */
|
|
18044
|
-
|
|
18045
18046
|
export declare function sanitizeString(str: any): string;
|
|
18046
18047
|
|
|
18047
18048
|
/** Download a image (must be a data url).
|
|
@@ -21475,23 +21476,36 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21475
21476
|
* Marks a GameObject as a valid teleportation target for VR locomotion.
|
|
21476
21477
|
* Add this component to objects or surfaces where users should be able to teleport.
|
|
21477
21478
|
*
|
|
21478
|
-
* **
|
|
21479
|
-
*
|
|
21480
|
-
*
|
|
21481
|
-
*
|
|
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`).
|
|
21482
21495
|
*
|
|
21483
21496
|
* **Setup:**
|
|
21484
|
-
* 1. Add this component to GameObjects that should be teleport destinations
|
|
21485
|
-
* 2.
|
|
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
|
|
21486
21500
|
* 3. Test teleportation in VR mode
|
|
21487
21501
|
*
|
|
21488
21502
|
* @example
|
|
21489
21503
|
* ```ts
|
|
21490
|
-
* // Make a platform teleportable
|
|
21504
|
+
* // Make a platform teleportable (the platform already has a visible mesh)
|
|
21491
21505
|
* const platform = myPlatform.addComponent(TeleportTarget);
|
|
21492
21506
|
* ```
|
|
21493
21507
|
*
|
|
21494
|
-
* @summary Marker component for valid VR teleportation destinations
|
|
21508
|
+
* @summary Marker component for valid VR teleportation destinations (mesh hit-test, no collider needed)
|
|
21495
21509
|
* @category XR
|
|
21496
21510
|
* @group Components
|
|
21497
21511
|
* @see {@link XRControllerMovement} for VR locomotion and teleport configuration
|
|
@@ -23982,9 +23996,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
23982
23996
|
autoPlace: boolean;
|
|
23983
23997
|
/** When enabled the scene center will be automatically calculated from the content in the scene */
|
|
23984
23998
|
autoCenter: boolean;
|
|
23985
|
-
/**
|
|
23986
|
-
*
|
|
23987
|
-
*
|
|
23999
|
+
/** When enabled a XR anchor is created at the scene placement position and the scene
|
|
24000
|
+
* stays at that anchored point while tracking refines during the XR session.
|
|
24001
|
+
* On platforms without WebXR anchor support this gracefully falls back to plain placement.
|
|
24002
|
+
* @default true
|
|
23988
24003
|
**/
|
|
23989
24004
|
useXRAnchor: boolean;
|
|
23990
24005
|
/** true if we're currently placing the scene */
|
|
@@ -23998,12 +24013,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
23998
24013
|
private readonly _placementScene;
|
|
23999
24014
|
/** the reticles used for placement */
|
|
24000
24015
|
private readonly _reticle;
|
|
24001
|
-
/**
|
|
24002
|
-
|
|
24016
|
+
/** reference-space hit poses, in sync with the reticles — captured while placing when {@link useXRAnchor}
|
|
24017
|
+
* is enabled, because hit test results can not be used outside the animation frame that produced them */
|
|
24018
|
+
private readonly _hitRefPoses;
|
|
24003
24019
|
private _placementStartTime;
|
|
24004
24020
|
private _rigPlacementMatrix?;
|
|
24005
24021
|
/** if useAnchor is enabled this is the anchor we have created on placing the scene using the placement hit */
|
|
24006
24022
|
private _anchor;
|
|
24023
|
+
/** the placement pose (reference space) waiting for anchor creation on the next animation frame */
|
|
24024
|
+
private _pendingAnchorPose;
|
|
24025
|
+
/** the last anchor pose (in rig space) that has been applied to the rig */
|
|
24026
|
+
private readonly _anchorLastLocalPose;
|
|
24007
24027
|
/** user input is used for ar touch transform */
|
|
24008
24028
|
private userInput?;
|
|
24009
24029
|
onEnable(): void;
|
|
@@ -24015,7 +24035,19 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
24015
24035
|
private onPlaceScene;
|
|
24016
24036
|
private onSetScale;
|
|
24017
24037
|
private onRevertSceneChanges;
|
|
24018
|
-
|
|
24038
|
+
/**
|
|
24039
|
+
* Deferred anchor creation and per-frame anchor tracking. Called from {@link onUpdateXR} after the scene has been placed.
|
|
24040
|
+
*
|
|
24041
|
+
* Creation can not happen during placement: `XRHitTestResult.createAnchor` only works while the animation
|
|
24042
|
+
* frame that produced the hit is active, and placement runs from an input event where that frame is already
|
|
24043
|
+
* over (`XRFrame.createAnchor` equally requires an active animation frame). So {@link onPlaceScene} only
|
|
24044
|
+
* records the reference-space pose and the anchor is created here, on the next animation frame.
|
|
24045
|
+
*
|
|
24046
|
+
* Once the anchor exists, its pose *changes* (delta in rig space) are applied to the XR rig: the world pose
|
|
24047
|
+
* of the anchored point stays constant while tracking refines, without discarding other rig modifications
|
|
24048
|
+
* ({@link arTouchTransform} user adjustments, {@link arScale}).
|
|
24049
|
+
*/
|
|
24050
|
+
private updateXRAnchor;
|
|
24019
24051
|
private upVec;
|
|
24020
24052
|
private lookPoint;
|
|
24021
24053
|
private worldUpVec;
|
|
@@ -24129,9 +24161,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
24129
24161
|
*/
|
|
24130
24162
|
arScale: number;
|
|
24131
24163
|
/**
|
|
24132
|
-
* When enabled, an XRAnchor
|
|
24133
|
-
*
|
|
24134
|
-
* @
|
|
24164
|
+
* When enabled, an XRAnchor is created at the AR placement position and the scene stays glued to it while tracking refines.
|
|
24165
|
+
* On platforms without WebXR anchor support this gracefully falls back to plain placement.
|
|
24166
|
+
* @default true
|
|
24135
24167
|
*/
|
|
24136
24168
|
useXRAnchor: boolean;
|
|
24137
24169
|
/**
|
|
@@ -24808,10 +24840,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
24808
24840
|
constructor(context: WebXRImageTracking, trackedImage: WebXRImageTrackingModel, bitmap: ImageBitmap, measuredSize: number, state: "tracked" | "emulated", pose: any);
|
|
24809
24841
|
}
|
|
24810
24842
|
|
|
24811
|
-
/* Excluded from this release type: _wHm */
|
|
24812
|
-
|
|
24813
24843
|
export declare type WriteCallback = (data: any, prop: string) => void;
|
|
24814
24844
|
|
|
24845
|
+
/* Excluded from this release type: _WXkIc */
|
|
24846
|
+
|
|
24815
24847
|
/** Button names as used in the xr profile */
|
|
24816
24848
|
export declare type XRControllerButtonName = "thumbrest" | "xr-standard-trigger" | "xr-standard-squeeze" | "xr-standard-thumbstick" | "xr-standard-touchpad" | "menu" | GamepadButtonName | StylusButtonName;
|
|
24817
24849
|
|
|
@@ -24922,6 +24954,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
24922
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).
|
|
24923
24955
|
* It also visualizes controller rays and hit points in the scene.
|
|
24924
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`.
|
|
24925
24966
|
*
|
|
24926
24967
|
* @summary Move the XR rig using controller input
|
|
24927
24968
|
* @category XR
|
|
@@ -24945,7 +24986,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
24945
24986
|
* @default true
|
|
24946
24987
|
*/
|
|
24947
24988
|
usePinchToTeleport: boolean;
|
|
24948
|
-
/** Enable to only allow teleporting on objects with a
|
|
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).
|
|
24949
24998
|
* @default false
|
|
24950
24999
|
*/
|
|
24951
25000
|
useTeleportTarget: boolean;
|