@needle-tools/engine 4.2.5 → 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.
- package/CHANGELOG.md +9 -0
- package/components.needle.json +1 -1
- package/dist/needle-engine.bundle.js +4245 -2977
- package/dist/needle-engine.bundle.light.js +4236 -2968
- package/dist/needle-engine.bundle.light.min.js +73 -73
- package/dist/needle-engine.bundle.light.umd.cjs +61 -61
- package/dist/needle-engine.bundle.min.js +62 -62
- package/dist/needle-engine.bundle.umd.cjs +61 -61
- package/dist/needle-engine.light.d.ts +9 -9
- package/dist/three-examples.js +825 -794
- package/dist/three-examples.light.js +825 -794
- package/dist/three-examples.light.min.js +12 -12
- package/dist/three-examples.light.umd.cjs +10 -10
- package/dist/three-examples.min.js +12 -12
- package/dist/three-examples.umd.cjs +10 -10
- package/lib/engine/engine_addressables.d.ts +3 -0
- package/lib/engine/engine_addressables.js +18 -0
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_input.d.ts +20 -1
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_types.d.ts +162 -17
- package/lib/engine-components/Animator.d.ts +129 -21
- package/lib/engine-components/Animator.js +115 -21
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AnimatorController.d.ts +161 -32
- package/lib/engine-components/AnimatorController.js +176 -29
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/AudioListener.d.ts +16 -5
- package/lib/engine-components/AudioListener.js +16 -5
- package/lib/engine-components/AudioListener.js.map +1 -1
- package/lib/engine-components/AudioSource.d.ts +120 -28
- package/lib/engine-components/AudioSource.js +120 -37
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/AvatarLoader.d.ts +61 -0
- package/lib/engine-components/AvatarLoader.js +61 -1
- package/lib/engine-components/AvatarLoader.js.map +1 -1
- package/lib/engine-components/AxesHelper.d.ts +19 -1
- package/lib/engine-components/AxesHelper.js +19 -1
- package/lib/engine-components/AxesHelper.js.map +1 -1
- package/lib/engine-components/BoxHelperComponent.d.ts +26 -0
- package/lib/engine-components/BoxHelperComponent.js +26 -0
- package/lib/engine-components/BoxHelperComponent.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +126 -37
- package/lib/engine-components/Camera.js +139 -37
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CameraUtils.js +20 -0
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +95 -21
- package/lib/engine-components/Collider.js +100 -23
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Component.d.ts +554 -106
- package/lib/engine-components/Component.js +352 -81
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +95 -21
- package/lib/engine-components/DragControls.js +126 -32
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DropListener.d.ts +99 -16
- package/lib/engine-components/DropListener.js +119 -14
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/Light.d.ts +102 -5
- package/lib/engine-components/Light.js +102 -44
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +28 -11
- package/lib/engine-components/NeedleMenu.js +28 -11
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/Networking.d.ts +37 -5
- package/lib/engine-components/Networking.js +37 -5
- package/lib/engine-components/Networking.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.d.ts +8 -0
- package/lib/engine-components/SceneSwitcher.js +72 -8
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/SpatialTrigger.d.ts +66 -1
- package/lib/engine-components/SpatialTrigger.js +74 -2
- package/lib/engine-components/SpatialTrigger.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.d.ts +66 -4
- package/lib/engine-components/SpectatorCamera.js +132 -6
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SyncedTransform.d.ts +45 -6
- package/lib/engine-components/SyncedTransform.js +45 -6
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/TransformGizmo.d.ts +49 -3
- package/lib/engine-components/TransformGizmo.js +49 -3
- package/lib/engine-components/TransformGizmo.js.map +1 -1
- package/lib/engine-components/ui/EventSystem.d.ts +1 -0
- package/lib/engine-components/ui/EventSystem.js +8 -5
- package/lib/engine-components/ui/EventSystem.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +131 -22
- package/lib/engine-components/webxr/WebXR.js +132 -23
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +82 -9
- package/lib/engine-components-experimental/networking/PlayerSync.js +76 -11
- package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
- package/package.json +1 -1
- package/plugins/vite/alias.js +6 -3
- package/src/engine/engine_addressables.ts +21 -0
- package/src/engine/engine_input.ts +20 -1
- package/src/engine/engine_types.ts +179 -18
- package/src/engine-components/Animator.ts +142 -22
- package/src/engine-components/AnimatorController.ts +184 -34
- package/src/engine-components/AudioListener.ts +16 -5
- package/src/engine-components/AudioSource.ts +126 -37
- package/src/engine-components/AvatarLoader.ts +61 -2
- package/src/engine-components/AxesHelper.ts +21 -1
- package/src/engine-components/BoxHelperComponent.ts +26 -0
- package/src/engine-components/Camera.ts +147 -41
- package/src/engine-components/CameraUtils.ts +20 -0
- package/src/engine-components/Collider.ts +102 -27
- package/src/engine-components/Component.ts +605 -129
- package/src/engine-components/DragControls.ts +134 -38
- package/src/engine-components/DropListener.ts +143 -23
- package/src/engine-components/Light.ts +105 -44
- package/src/engine-components/NeedleMenu.ts +29 -11
- package/src/engine-components/Networking.ts +37 -6
- package/src/engine-components/SceneSwitcher.ts +78 -9
- package/src/engine-components/SpatialTrigger.ts +80 -3
- package/src/engine-components/SpectatorCamera.ts +136 -18
- package/src/engine-components/SyncedTransform.ts +50 -7
- package/src/engine-components/TransformGizmo.ts +49 -4
- package/src/engine-components/ui/EventSystem.ts +9 -7
- package/src/engine-components/webxr/WebXR.ts +144 -27
- package/src/engine-components-experimental/networking/PlayerSync.ts +85 -13
|
@@ -3,6 +3,7 @@ import { AssetReference } from "../../engine/engine_addressables.js";
|
|
|
3
3
|
import type { ComponentInit, IGameObject } from "../../engine/engine_types.js";
|
|
4
4
|
import { Behaviour, Component } from "../../engine-components/Component.js";
|
|
5
5
|
import { EventList } from "../../engine-components/EventList.js";
|
|
6
|
+
/** Type definition for a PlayerSync instance with a guaranteed asset property */
|
|
6
7
|
declare type PlayerSyncWithAsset = PlayerSync & Required<Pick<PlayerSync, "asset">>;
|
|
7
8
|
/**
|
|
8
9
|
* This component instantiates an asset for each player that joins a networked room. The asset will be destroyed when the player leaves the room.
|
|
@@ -12,7 +13,10 @@ declare type PlayerSyncWithAsset = PlayerSync & Required<Pick<PlayerSync, "asset
|
|
|
12
13
|
export declare class PlayerSync extends Behaviour {
|
|
13
14
|
/**
|
|
14
15
|
* This API is experimental and may change or be removed in the future.
|
|
15
|
-
*
|
|
16
|
+
* Creates a PlayerSync instance at runtime from a given URL and sets it up for networking
|
|
17
|
+
* @param url Path to the asset that should be instantiated for each player
|
|
18
|
+
* @param init Optional initialization parameters for the PlayerSync component
|
|
19
|
+
* @returns Promise resolving to a PlayerSync instance with a guaranteed asset property
|
|
16
20
|
* @example
|
|
17
21
|
* ```typescript
|
|
18
22
|
* const res = await PlayerSync.setupFrom("/assets/demo.glb");
|
|
@@ -22,62 +26,131 @@ export declare class PlayerSync extends Behaviour {
|
|
|
22
26
|
* ```
|
|
23
27
|
*/
|
|
24
28
|
static setupFrom(url: string, init?: Omit<ComponentInit<PlayerSync>, "asset">): Promise<PlayerSyncWithAsset>;
|
|
25
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* When enabled, PlayerSync will automatically load and instantiate the assigned asset when joining a networked room
|
|
31
|
+
*/
|
|
26
32
|
autoSync: boolean;
|
|
27
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* The asset that will be loaded and instantiated when PlayerSync becomes active and joins a networked room
|
|
35
|
+
*/
|
|
28
36
|
asset?: AssetReference;
|
|
29
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Event invoked when a player instance is spawned with the spawned {@link Object3D} as parameter
|
|
39
|
+
* @serializable
|
|
40
|
+
*/
|
|
30
41
|
onPlayerSpawned?: EventList<Object3D>;
|
|
31
42
|
private _localInstance?;
|
|
32
43
|
awake(): void;
|
|
33
44
|
onEnable(): void;
|
|
34
45
|
onDisable(): void;
|
|
35
46
|
private onJoinedRoom;
|
|
47
|
+
/**
|
|
48
|
+
* Gets or creates an instance of the assigned asset for the local player
|
|
49
|
+
* @returns Promise resolving to the instantiated player object or null if creation failed
|
|
50
|
+
*/
|
|
36
51
|
getInstance(): Promise<IGameObject | null | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Destroys the current player instance and cleans up networking state
|
|
54
|
+
*/
|
|
37
55
|
destroyInstance: () => void;
|
|
56
|
+
/**
|
|
57
|
+
* Sets up visibility change listeners to handle player cleanup when browser tab visibility changes
|
|
58
|
+
*/
|
|
38
59
|
private watchTabVisible;
|
|
39
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Enum defining events that can be triggered by PlayerState
|
|
63
|
+
*/
|
|
40
64
|
export declare enum PlayerStateEvent {
|
|
65
|
+
/** Triggered when a PlayerState's owner property changes */
|
|
41
66
|
OwnerChanged = "ownerChanged"
|
|
42
67
|
}
|
|
68
|
+
/** Arguments passed when a PlayerState's owner changes */
|
|
43
69
|
export declare interface PlayerStateOwnerChangedArgs {
|
|
70
|
+
/** The PlayerState instance that changed */
|
|
44
71
|
playerState: PlayerState;
|
|
72
|
+
/** Previous owner's connection ID */
|
|
45
73
|
oldValue: string;
|
|
74
|
+
/** New owner's connection ID */
|
|
46
75
|
newValue: string;
|
|
47
76
|
}
|
|
77
|
+
/** Callback type for PlayerState events */
|
|
48
78
|
export declare type PlayerStateEventCallback = (args: CustomEvent<PlayerStateOwnerChangedArgs>) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Represents a player instance in the networked environment.
|
|
81
|
+
* Handles ownership, synchronization, and lifecycle management of player objects.
|
|
82
|
+
*/
|
|
49
83
|
export declare class PlayerState extends Behaviour {
|
|
50
84
|
private static _all;
|
|
51
|
-
/**
|
|
85
|
+
/** All PlayerState instances for all players in the scene */
|
|
52
86
|
static get all(): PlayerState[];
|
|
53
87
|
private static _local;
|
|
54
|
-
/**
|
|
88
|
+
/** All PlayerState instances that belong to the local player */
|
|
55
89
|
static get local(): PlayerState[];
|
|
90
|
+
/**
|
|
91
|
+
* Gets the PlayerState component for a given object or component
|
|
92
|
+
* @param obj Object3D or Component to find the PlayerState for
|
|
93
|
+
* @returns The PlayerState component if found, undefined otherwise
|
|
94
|
+
*/
|
|
56
95
|
static getFor(obj: Object3D | Component): PlayerState | null | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Checks if a given object or component belongs to the local player
|
|
98
|
+
* @param obj Object3D or Component to check
|
|
99
|
+
* @returns True if the object belongs to the local player, false otherwise
|
|
100
|
+
*/
|
|
57
101
|
static isLocalPlayer(obj: Object3D | Component): boolean;
|
|
58
102
|
private static _callbacks;
|
|
59
103
|
/**
|
|
60
|
-
*
|
|
104
|
+
* Registers a callback for a specific PlayerState event
|
|
105
|
+
* @param event The event to listen for
|
|
106
|
+
* @param cb Callback function that will be invoked when the event occurs
|
|
107
|
+
* @returns The provided callback function for chaining
|
|
61
108
|
*/
|
|
62
109
|
static addEventListener(event: PlayerStateEvent, cb: PlayerStateEventCallback): PlayerStateEventCallback;
|
|
110
|
+
/**
|
|
111
|
+
* Removes a previously registered event callback
|
|
112
|
+
* @param event The event type to remove the callback from
|
|
113
|
+
* @param cb The callback function to remove
|
|
114
|
+
*/
|
|
63
115
|
static removeEventListener(event: PlayerStateEvent, cb: PlayerStateEventCallback): void;
|
|
64
116
|
private static dispatchEvent;
|
|
117
|
+
/** Event triggered when the owner of this PlayerState changes */
|
|
65
118
|
onOwnerChangeEvent: EventList<any>;
|
|
119
|
+
/** Event triggered the first time an owner is assigned to this PlayerState */
|
|
66
120
|
onFirstOwnerChangeEvent: EventList<any>;
|
|
121
|
+
/** Indicates if this PlayerState has an owner assigned */
|
|
67
122
|
hasOwner: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* The connection ID of the player who owns this PlayerState instance
|
|
125
|
+
* @syncField Synchronized across the network
|
|
126
|
+
*/
|
|
68
127
|
owner?: string;
|
|
69
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* When enabled, PlayerState will not destroy itself when the owner is not connected anymore
|
|
130
|
+
*/
|
|
70
131
|
dontDestroy: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Indicates if this PlayerState belongs to the local player
|
|
134
|
+
*/
|
|
71
135
|
get isLocalPlayer(): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Handles owner change events and updates relevant state
|
|
138
|
+
* @param newOwner The new owner's connection ID
|
|
139
|
+
* @param oldOwner The previous owner's connection ID
|
|
140
|
+
*/
|
|
72
141
|
private onOwnerChange;
|
|
73
142
|
/** @internal */
|
|
74
143
|
awake(): void;
|
|
75
144
|
/** @internal */
|
|
76
145
|
start(): Promise<void>;
|
|
77
|
-
/**
|
|
146
|
+
/** Tells the server that this client has been destroyed, and the networking message for the instantiate will be removed */
|
|
78
147
|
doDestroy(): void;
|
|
79
148
|
/** @internal */
|
|
80
149
|
onDestroy(): void;
|
|
150
|
+
/**
|
|
151
|
+
* Handler for when a user leaves the networked room
|
|
152
|
+
* @param model Object containing the ID of the user who left
|
|
153
|
+
*/
|
|
81
154
|
private onUserLeftRoom;
|
|
82
155
|
}
|
|
83
156
|
export {};
|
|
@@ -22,7 +22,10 @@ const debug = getParam("debugplayersync");
|
|
|
22
22
|
export class PlayerSync extends Behaviour {
|
|
23
23
|
/**
|
|
24
24
|
* This API is experimental and may change or be removed in the future.
|
|
25
|
-
*
|
|
25
|
+
* Creates a PlayerSync instance at runtime from a given URL and sets it up for networking
|
|
26
|
+
* @param url Path to the asset that should be instantiated for each player
|
|
27
|
+
* @param init Optional initialization parameters for the PlayerSync component
|
|
28
|
+
* @returns Promise resolving to a PlayerSync instance with a guaranteed asset property
|
|
26
29
|
* @example
|
|
27
30
|
* ```typescript
|
|
28
31
|
* const res = await PlayerSync.setupFrom("/assets/demo.glb");
|
|
@@ -46,11 +49,18 @@ export class PlayerSync extends Behaviour {
|
|
|
46
49
|
GameObject.addComponent(obj, ps);
|
|
47
50
|
return ps;
|
|
48
51
|
}
|
|
49
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* When enabled, PlayerSync will automatically load and instantiate the assigned asset when joining a networked room
|
|
54
|
+
*/
|
|
50
55
|
autoSync = true;
|
|
51
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* The asset that will be loaded and instantiated when PlayerSync becomes active and joins a networked room
|
|
58
|
+
*/
|
|
52
59
|
asset;
|
|
53
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Event invoked when a player instance is spawned with the spawned {@link Object3D} as parameter
|
|
62
|
+
* @serializable
|
|
63
|
+
*/
|
|
54
64
|
onPlayerSpawned;
|
|
55
65
|
_localInstance;
|
|
56
66
|
awake() {
|
|
@@ -77,6 +87,10 @@ export class PlayerSync extends Behaviour {
|
|
|
77
87
|
if (this.autoSync)
|
|
78
88
|
this.getInstance();
|
|
79
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Gets or creates an instance of the assigned asset for the local player
|
|
92
|
+
* @returns Promise resolving to the instantiated player object or null if creation failed
|
|
93
|
+
*/
|
|
80
94
|
async getInstance() {
|
|
81
95
|
if (this._localInstance)
|
|
82
96
|
return this._localInstance;
|
|
@@ -112,6 +126,9 @@ export class PlayerSync extends Behaviour {
|
|
|
112
126
|
}
|
|
113
127
|
return this._localInstance;
|
|
114
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Destroys the current player instance and cleans up networking state
|
|
131
|
+
*/
|
|
115
132
|
destroyInstance = () => {
|
|
116
133
|
this._localInstance?.then(go => {
|
|
117
134
|
if (debug)
|
|
@@ -120,6 +137,9 @@ export class PlayerSync extends Behaviour {
|
|
|
120
137
|
});
|
|
121
138
|
this._localInstance = undefined;
|
|
122
139
|
};
|
|
140
|
+
/**
|
|
141
|
+
* Sets up visibility change listeners to handle player cleanup when browser tab visibility changes
|
|
142
|
+
*/
|
|
123
143
|
watchTabVisible() {
|
|
124
144
|
window.addEventListener("visibilitychange", _ => {
|
|
125
145
|
if (document.visibilityState === "visible") {
|
|
@@ -142,22 +162,35 @@ __decorate([
|
|
|
142
162
|
__decorate([
|
|
143
163
|
serializable(EventList)
|
|
144
164
|
], PlayerSync.prototype, "onPlayerSpawned", void 0);
|
|
165
|
+
/**
|
|
166
|
+
* Enum defining events that can be triggered by PlayerState
|
|
167
|
+
*/
|
|
145
168
|
export var PlayerStateEvent;
|
|
146
169
|
(function (PlayerStateEvent) {
|
|
170
|
+
/** Triggered when a PlayerState's owner property changes */
|
|
147
171
|
PlayerStateEvent["OwnerChanged"] = "ownerChanged";
|
|
148
172
|
})(PlayerStateEvent || (PlayerStateEvent = {}));
|
|
173
|
+
/**
|
|
174
|
+
* Represents a player instance in the networked environment.
|
|
175
|
+
* Handles ownership, synchronization, and lifecycle management of player objects.
|
|
176
|
+
*/
|
|
149
177
|
export class PlayerState extends Behaviour {
|
|
150
178
|
static _all = [];
|
|
151
|
-
/**
|
|
179
|
+
/** All PlayerState instances for all players in the scene */
|
|
152
180
|
static get all() {
|
|
153
181
|
return PlayerState._all;
|
|
154
182
|
}
|
|
155
183
|
;
|
|
156
184
|
static _local = [];
|
|
157
|
-
/**
|
|
185
|
+
/** All PlayerState instances that belong to the local player */
|
|
158
186
|
static get local() {
|
|
159
187
|
return PlayerState._local;
|
|
160
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Gets the PlayerState component for a given object or component
|
|
191
|
+
* @param obj Object3D or Component to find the PlayerState for
|
|
192
|
+
* @returns The PlayerState component if found, undefined otherwise
|
|
193
|
+
*/
|
|
161
194
|
static getFor(obj) {
|
|
162
195
|
if (obj instanceof Object3D) {
|
|
163
196
|
return GameObject.getComponentInParent(obj, PlayerState);
|
|
@@ -167,15 +200,21 @@ export class PlayerState extends Behaviour {
|
|
|
167
200
|
}
|
|
168
201
|
return undefined;
|
|
169
202
|
}
|
|
170
|
-
|
|
203
|
+
/**
|
|
204
|
+
* Checks if a given object or component belongs to the local player
|
|
205
|
+
* @param obj Object3D or Component to check
|
|
206
|
+
* @returns True if the object belongs to the local player, false otherwise
|
|
207
|
+
*/
|
|
171
208
|
static isLocalPlayer(obj) {
|
|
172
209
|
const state = PlayerState.getFor(obj);
|
|
173
210
|
return state?.isLocalPlayer ?? false;
|
|
174
211
|
}
|
|
175
|
-
// static Callback
|
|
176
212
|
static _callbacks = {};
|
|
177
213
|
/**
|
|
178
|
-
*
|
|
214
|
+
* Registers a callback for a specific PlayerState event
|
|
215
|
+
* @param event The event to listen for
|
|
216
|
+
* @param cb Callback function that will be invoked when the event occurs
|
|
217
|
+
* @returns The provided callback function for chaining
|
|
179
218
|
*/
|
|
180
219
|
static addEventListener(event, cb) {
|
|
181
220
|
if (!this._callbacks[event])
|
|
@@ -183,6 +222,11 @@ export class PlayerState extends Behaviour {
|
|
|
183
222
|
this._callbacks[event].push(cb);
|
|
184
223
|
return cb;
|
|
185
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Removes a previously registered event callback
|
|
227
|
+
* @param event The event type to remove the callback from
|
|
228
|
+
* @param cb The callback function to remove
|
|
229
|
+
*/
|
|
186
230
|
static removeEventListener(event, cb) {
|
|
187
231
|
if (!this._callbacks[event])
|
|
188
232
|
return;
|
|
@@ -197,15 +241,32 @@ export class PlayerState extends Behaviour {
|
|
|
197
241
|
cb(args);
|
|
198
242
|
}
|
|
199
243
|
}
|
|
244
|
+
/** Event triggered when the owner of this PlayerState changes */
|
|
200
245
|
onOwnerChangeEvent = new EventList();
|
|
246
|
+
/** Event triggered the first time an owner is assigned to this PlayerState */
|
|
201
247
|
onFirstOwnerChangeEvent = new EventList();
|
|
248
|
+
/** Indicates if this PlayerState has an owner assigned */
|
|
202
249
|
hasOwner = false;
|
|
250
|
+
/**
|
|
251
|
+
* The connection ID of the player who owns this PlayerState instance
|
|
252
|
+
* @syncField Synchronized across the network
|
|
253
|
+
*/
|
|
203
254
|
owner;
|
|
204
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* When enabled, PlayerState will not destroy itself when the owner is not connected anymore
|
|
257
|
+
*/
|
|
205
258
|
dontDestroy = false;
|
|
259
|
+
/**
|
|
260
|
+
* Indicates if this PlayerState belongs to the local player
|
|
261
|
+
*/
|
|
206
262
|
get isLocalPlayer() {
|
|
207
263
|
return this.owner === this.context.connection.connectionId;
|
|
208
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Handles owner change events and updates relevant state
|
|
267
|
+
* @param newOwner The new owner's connection ID
|
|
268
|
+
* @param oldOwner The previous owner's connection ID
|
|
269
|
+
*/
|
|
209
270
|
onOwnerChange(newOwner, oldOwner) {
|
|
210
271
|
if (debug)
|
|
211
272
|
console.log(`PlayerSync.onOwnerChange: ${oldOwner} → ${newOwner} (me: ${this.context.connection.connectionId})`);
|
|
@@ -280,7 +341,7 @@ export class PlayerState extends Behaviour {
|
|
|
280
341
|
}, 2000);
|
|
281
342
|
}
|
|
282
343
|
}
|
|
283
|
-
/**
|
|
344
|
+
/** Tells the server that this client has been destroyed, and the networking message for the instantiate will be removed */
|
|
284
345
|
doDestroy() {
|
|
285
346
|
if (debug)
|
|
286
347
|
console.log("PlayerSync.doDestroy → syncDestroy", this.name);
|
|
@@ -298,6 +359,10 @@ export class PlayerState extends Behaviour {
|
|
|
298
359
|
PlayerState._local.splice(index, 1);
|
|
299
360
|
}
|
|
300
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Handler for when a user leaves the networked room
|
|
364
|
+
* @param model Object containing the ID of the user who left
|
|
365
|
+
*/
|
|
301
366
|
onUserLeftRoom = (model) => {
|
|
302
367
|
if (model.userId === this.owner) {
|
|
303
368
|
if (debug)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerSync.js","sourceRoot":"","sources":["../../../src/engine-components-experimental/networking/PlayerSync.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEjE,MAAM,KAAK,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAI1C;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,SAAS;IAErC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAW,EAAE,IAA+C;QAC/E,MAAM,cAAc,GAAG,cAAc,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC9D,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE;YACvB,MAAM,CAAC,GAAG,MAAM,cAAc,CAAC,cAAc,EAAE,CAAC;YAChD,IAAG,CAAC;gBAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;SACtD;QACD,MAAM,EAAE,GAAG,IAAI,UAAU,EAAE,CAAC;QAC5B,EAAE,CAAC,aAAa,CAAC,IAAI,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AAG,CAAC,KAAyB,EAAE,EAAE;QACnD,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,EAAE;YAC7B,IAAI,KAAK;gBACL,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;YAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,OAAO;SACV;IACL,CAAC,CAAA;;AA3HD;IADC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC;0CAChC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-alpha.1",
|
|
4
4
|
"description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in",
|
|
5
5
|
"main": "dist/needle-engine.min.js",
|
|
6
6
|
"exports": {
|
package/plugins/vite/alias.js
CHANGED
|
@@ -57,6 +57,8 @@ export const needleViteAlias = (command, config, userSettings) => {
|
|
|
57
57
|
}
|
|
58
58
|
if (debug) {
|
|
59
59
|
const outputFilePath = path.resolve(projectDir, 'node_modules/.vite/needle.alias.log');
|
|
60
|
+
const outputDirectory = path.dirname(outputFilePath);
|
|
61
|
+
if (!existsSync(outputDirectory)) mkdirSync(outputDirectory, { recursive: true });
|
|
60
62
|
outputDebugFile = createWriteStream(outputFilePath, { flags: "a" });
|
|
61
63
|
const timestamp = new Date().toISOString();
|
|
62
64
|
outputDebugFile.write("\n\n\n--------------------------\n");
|
|
@@ -68,7 +70,7 @@ export const needleViteAlias = (command, config, userSettings) => {
|
|
|
68
70
|
const aliasPlugin = {
|
|
69
71
|
name: "needle-alias",
|
|
70
72
|
config(config) {
|
|
71
|
-
if (debug)
|
|
73
|
+
if (debug) console.log('[needle-alias] ProjectDirectory: ' + projectDir);
|
|
72
74
|
if (!config.resolve) config.resolve = {};
|
|
73
75
|
if (!config.resolve.alias) config.resolve.alias = {};
|
|
74
76
|
const aliasDict = config.resolve.alias;
|
|
@@ -97,6 +99,7 @@ export const needleViteAlias = (command, config, userSettings) => {
|
|
|
97
99
|
let lastImporter = "";
|
|
98
100
|
/** This plugin logs all imports. This helps to find cases where incorrect folders are found/resolved. */
|
|
99
101
|
|
|
102
|
+
/** @type {import("vite").Plugin} */
|
|
100
103
|
const debuggingPlugin = {
|
|
101
104
|
name: "needle:alias-debug",
|
|
102
105
|
// needs to run before regular resolver
|
|
@@ -115,9 +118,9 @@ export const needleViteAlias = (command, config, userSettings) => {
|
|
|
115
118
|
// verbose logging for all imports
|
|
116
119
|
if (lastImporter !== importer) {
|
|
117
120
|
lastImporter = importer;
|
|
118
|
-
log(
|
|
121
|
+
log(`[needle-alias] Resolving: ${importer} (file${options?.ssr ? ", SSR" : ""})`);
|
|
119
122
|
}
|
|
120
|
-
log(
|
|
123
|
+
log(`[needle-alias] → ${id}`);
|
|
121
124
|
return;
|
|
122
125
|
},
|
|
123
126
|
}
|
|
@@ -164,6 +164,11 @@ export class AssetReference {
|
|
|
164
164
|
return this._url;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
/** The name of the assigned url. This name is deduced from the url and might not reflect the actual name of the asset */
|
|
168
|
+
get urlName(): string {
|
|
169
|
+
return this._urlName;
|
|
170
|
+
};
|
|
171
|
+
|
|
167
172
|
/**
|
|
168
173
|
* @returns true if the uri is a valid URL (http, https, blob)
|
|
169
174
|
*/
|
|
@@ -180,6 +185,7 @@ export class AssetReference {
|
|
|
180
185
|
private _asset: any;
|
|
181
186
|
private _glbRoot?: Object3D | null;
|
|
182
187
|
private _url: string;
|
|
188
|
+
private _urlName: string;
|
|
183
189
|
private _progressListeners: ProgressCallback[] = [];
|
|
184
190
|
|
|
185
191
|
private _hash?: string;
|
|
@@ -191,12 +197,27 @@ export class AssetReference {
|
|
|
191
197
|
/** @internal */
|
|
192
198
|
constructor(uri: string, hash?: string, asset: any = null) {
|
|
193
199
|
this._url = uri;
|
|
200
|
+
|
|
201
|
+
const lastUriPart = uri.lastIndexOf("/");
|
|
202
|
+
if (lastUriPart >= 0) {
|
|
203
|
+
this._urlName = uri.substring(lastUriPart + 1);
|
|
204
|
+
// remove file extension
|
|
205
|
+
const lastDot = this._urlName.lastIndexOf(".");
|
|
206
|
+
if (lastDot >= 0) {
|
|
207
|
+
this._urlName = this._urlName.substring(0, lastDot);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this._urlName = uri;
|
|
212
|
+
}
|
|
213
|
+
|
|
194
214
|
this._hash = hash;
|
|
195
215
|
if (uri.includes("?v="))
|
|
196
216
|
this._hashedUri = uri;
|
|
197
217
|
else
|
|
198
218
|
this._hashedUri = hash ? uri + "?v=" + hash : uri;
|
|
199
219
|
if (asset !== null) this.asset = asset;
|
|
220
|
+
|
|
200
221
|
registerPrefabProvider(this._url, this.onResolvePrefab.bind(this));
|
|
201
222
|
}
|
|
202
223
|
|
|
@@ -255,7 +255,26 @@ export class Input implements IInput {
|
|
|
255
255
|
/** Adds an event listener for the specified event type. The callback will be called when the event is triggered.
|
|
256
256
|
* @param type The event type to listen for
|
|
257
257
|
* @param callback The callback to call when the event is triggered
|
|
258
|
-
* @param options The options for adding the event listener
|
|
258
|
+
* @param options The options for adding the event listener.
|
|
259
|
+
* @example Basic usage:
|
|
260
|
+
* ```ts
|
|
261
|
+
* input.addEventListener("pointerdown", (evt) => {
|
|
262
|
+
* console.log("Pointer down", evt.pointerId, evt.pointerType);
|
|
263
|
+
* });
|
|
264
|
+
* ```
|
|
265
|
+
* @example Adding a listener that is called after all other listeners
|
|
266
|
+
* By using a higher value for the queue the listener will be called after other listeners (default queue is 0).
|
|
267
|
+
* ```ts
|
|
268
|
+
* input.addEventListener("pointerdown", (evt) => {
|
|
269
|
+
* console.log("Pointer down", evt.pointerId, evt.pointerType);
|
|
270
|
+
* }, { queue: 10 });
|
|
271
|
+
* ```
|
|
272
|
+
* @example Adding a listener that is only called once
|
|
273
|
+
* ```ts
|
|
274
|
+
* input.addEventListener("pointerdown", (evt) => {
|
|
275
|
+
* console.log("Pointer down", evt.pointerId, evt.pointerType);
|
|
276
|
+
* }, { once: true });
|
|
277
|
+
* ```
|
|
259
278
|
*/
|
|
260
279
|
addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions);
|
|
261
280
|
addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions);
|