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

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 (122) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/needle-engine.bundle.js +6683 -5393
  3. package/dist/needle-engine.bundle.light.js +6687 -5397
  4. package/dist/needle-engine.bundle.light.min.js +121 -118
  5. package/dist/needle-engine.bundle.light.umd.cjs +128 -125
  6. package/dist/needle-engine.bundle.min.js +119 -116
  7. package/dist/needle-engine.bundle.umd.cjs +124 -121
  8. package/dist/needle-engine.d.ts +9 -9
  9. package/dist/needle-engine.light.d.ts +9 -9
  10. package/lib/engine/engine_context.js +1 -1
  11. package/lib/engine/engine_context.js.map +1 -1
  12. package/lib/engine/engine_mainloop_utils.js +2 -4
  13. package/lib/engine/engine_mainloop_utils.js.map +1 -1
  14. package/lib/engine/engine_serialization_core.js +1 -1
  15. package/lib/engine/engine_serialization_core.js.map +1 -1
  16. package/lib/engine/engine_types.d.ts +162 -17
  17. package/lib/engine/xr/NeedleXRSession.d.ts +6 -1
  18. package/lib/engine/xr/NeedleXRSession.js +6 -1
  19. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  20. package/lib/engine-components/Animator.d.ts +129 -21
  21. package/lib/engine-components/Animator.js +115 -21
  22. package/lib/engine-components/Animator.js.map +1 -1
  23. package/lib/engine-components/AnimatorController.d.ts +161 -32
  24. package/lib/engine-components/AnimatorController.js +176 -29
  25. package/lib/engine-components/AnimatorController.js.map +1 -1
  26. package/lib/engine-components/AudioListener.d.ts +16 -5
  27. package/lib/engine-components/AudioListener.js +16 -5
  28. package/lib/engine-components/AudioListener.js.map +1 -1
  29. package/lib/engine-components/AudioSource.d.ts +120 -28
  30. package/lib/engine-components/AudioSource.js +121 -40
  31. package/lib/engine-components/AudioSource.js.map +1 -1
  32. package/lib/engine-components/AvatarLoader.d.ts +61 -0
  33. package/lib/engine-components/AvatarLoader.js +61 -1
  34. package/lib/engine-components/AvatarLoader.js.map +1 -1
  35. package/lib/engine-components/AxesHelper.d.ts +19 -1
  36. package/lib/engine-components/AxesHelper.js +19 -1
  37. package/lib/engine-components/AxesHelper.js.map +1 -1
  38. package/lib/engine-components/BoxHelperComponent.d.ts +26 -0
  39. package/lib/engine-components/BoxHelperComponent.js +26 -0
  40. package/lib/engine-components/BoxHelperComponent.js.map +1 -1
  41. package/lib/engine-components/Camera.d.ts +126 -37
  42. package/lib/engine-components/Camera.js +139 -37
  43. package/lib/engine-components/Camera.js.map +1 -1
  44. package/lib/engine-components/CameraUtils.js +20 -0
  45. package/lib/engine-components/CameraUtils.js.map +1 -1
  46. package/lib/engine-components/Collider.d.ts +95 -21
  47. package/lib/engine-components/Collider.js +100 -23
  48. package/lib/engine-components/Collider.js.map +1 -1
  49. package/lib/engine-components/Component.d.ts +554 -106
  50. package/lib/engine-components/Component.js +352 -81
  51. package/lib/engine-components/Component.js.map +1 -1
  52. package/lib/engine-components/DragControls.d.ts +95 -21
  53. package/lib/engine-components/DragControls.js +126 -32
  54. package/lib/engine-components/DragControls.js.map +1 -1
  55. package/lib/engine-components/DropListener.d.ts +99 -16
  56. package/lib/engine-components/DropListener.js +119 -14
  57. package/lib/engine-components/DropListener.js.map +1 -1
  58. package/lib/engine-components/Light.d.ts +102 -5
  59. package/lib/engine-components/Light.js +102 -44
  60. package/lib/engine-components/Light.js.map +1 -1
  61. package/lib/engine-components/NeedleMenu.d.ts +28 -11
  62. package/lib/engine-components/NeedleMenu.js +28 -11
  63. package/lib/engine-components/NeedleMenu.js.map +1 -1
  64. package/lib/engine-components/Networking.d.ts +37 -5
  65. package/lib/engine-components/Networking.js +37 -5
  66. package/lib/engine-components/Networking.js.map +1 -1
  67. package/lib/engine-components/SceneSwitcher.js +44 -0
  68. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  69. package/lib/engine-components/SpatialTrigger.d.ts +66 -1
  70. package/lib/engine-components/SpatialTrigger.js +74 -2
  71. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  72. package/lib/engine-components/SpectatorCamera.d.ts +66 -4
  73. package/lib/engine-components/SpectatorCamera.js +132 -6
  74. package/lib/engine-components/SpectatorCamera.js.map +1 -1
  75. package/lib/engine-components/SyncedTransform.d.ts +45 -6
  76. package/lib/engine-components/SyncedTransform.js +45 -6
  77. package/lib/engine-components/SyncedTransform.js.map +1 -1
  78. package/lib/engine-components/TransformGizmo.d.ts +49 -3
  79. package/lib/engine-components/TransformGizmo.js +49 -3
  80. package/lib/engine-components/TransformGizmo.js.map +1 -1
  81. package/lib/engine-components/particlesystem/ParticleSystem.js +1 -1
  82. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  83. package/lib/engine-components/webxr/WebARSessionRoot.d.ts +8 -3
  84. package/lib/engine-components/webxr/WebARSessionRoot.js +30 -9
  85. package/lib/engine-components/webxr/WebARSessionRoot.js.map +1 -1
  86. package/lib/engine-components/webxr/WebXR.d.ts +156 -25
  87. package/lib/engine-components/webxr/WebXR.js +160 -26
  88. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  89. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +82 -9
  90. package/lib/engine-components-experimental/networking/PlayerSync.js +76 -11
  91. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  92. package/package.json +1 -1
  93. package/src/engine/engine_context.ts +1 -1
  94. package/src/engine/engine_mainloop_utils.ts +2 -4
  95. package/src/engine/engine_serialization_core.ts +1 -1
  96. package/src/engine/engine_types.ts +179 -18
  97. package/src/engine/xr/NeedleXRSession.ts +7 -1
  98. package/src/engine-components/Animator.ts +142 -22
  99. package/src/engine-components/AnimatorController.ts +184 -34
  100. package/src/engine-components/AudioListener.ts +16 -5
  101. package/src/engine-components/AudioSource.ts +127 -39
  102. package/src/engine-components/AvatarLoader.ts +61 -2
  103. package/src/engine-components/AxesHelper.ts +21 -1
  104. package/src/engine-components/BoxHelperComponent.ts +26 -0
  105. package/src/engine-components/Camera.ts +147 -41
  106. package/src/engine-components/CameraUtils.ts +20 -0
  107. package/src/engine-components/Collider.ts +102 -27
  108. package/src/engine-components/Component.ts +605 -129
  109. package/src/engine-components/DragControls.ts +134 -38
  110. package/src/engine-components/DropListener.ts +143 -23
  111. package/src/engine-components/Light.ts +105 -44
  112. package/src/engine-components/NeedleMenu.ts +29 -11
  113. package/src/engine-components/Networking.ts +37 -6
  114. package/src/engine-components/SceneSwitcher.ts +48 -1
  115. package/src/engine-components/SpatialTrigger.ts +80 -3
  116. package/src/engine-components/SpectatorCamera.ts +136 -18
  117. package/src/engine-components/SyncedTransform.ts +50 -7
  118. package/src/engine-components/TransformGizmo.ts +49 -4
  119. package/src/engine-components/particlesystem/ParticleSystem.ts +2 -2
  120. package/src/engine-components/webxr/WebARSessionRoot.ts +31 -8
  121. package/src/engine-components/webxr/WebXR.ts +173 -29
  122. package/src/engine-components-experimental/networking/PlayerSync.ts +85 -13
@@ -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
- * Create a PlayerSync instance at runtime from a given URL
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
- /** when enabled PlayerSync will automatically load and instantiate the assigned asset when joining a networked room */
52
+ /**
53
+ * When enabled, PlayerSync will automatically load and instantiate the assigned asset when joining a networked room
54
+ */
50
55
  autoSync = true;
51
- /** This asset will be loaded and instantiated when PlayerSync becomes active and joins a networked room */
56
+ /**
57
+ * The asset that will be loaded and instantiated when PlayerSync becomes active and joins a networked room
58
+ */
52
59
  asset;
53
- /** Event called when an instance is spawned */
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
- /** all instances for all players */
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
- /** all instances for the local player */
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
- //** use to check if a component or gameobject is part of a instance owned by the local player */
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
- * Add a callback for a PlayerStateEvent
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
- /** when enabled PlayerSync will not destroy itself when not connected anymore */
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
- /** this tells the server that this client has been destroyed and the networking message for the instantiate will be removed */
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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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "4.3.0-alpha",
3
+ "version": "4.3.0-alpha.3",
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": {
@@ -864,7 +864,7 @@ export class Context implements IContext {
864
864
  if (name.length > 3) offendingComponentName = name;
865
865
  }
866
866
  }
867
- console.error(`Needle Engine dependencies failed to load:\n\n# Make sure you don't have circular imports in your scripts!\n Possible solution: Replace @serializable(${offendingComponentName}) in your script with @serializable(Behaviour)\n\n---`, err)
867
+ console.error(`Needle Engine dependencies failed to load:\n\n# Make sure you don't have circular imports in your scripts!\n\nPossible solutions: \n→ Replace @serializable(${offendingComponentName}) in your script with @serializable(Behaviour)\n→ If you only need type information try importing the type only, e.g: import { type ${offendingComponentName} }\n\n---`, err)
868
868
  return;
869
869
  }
870
870
  if (!printedError) {
@@ -326,8 +326,7 @@ function updateIsActiveInHierarchyRecursiveRuntime(go: Object3D, activeInHierarc
326
326
  if (comp.enabled) {
327
327
  safeInvoke(comp.__internalAwake.bind(comp));
328
328
  if (comp.enabled) {
329
- comp["__didEnable"] = true;
330
- comp.onEnable();
329
+ comp.__internalEnable();
331
330
  }
332
331
  }
333
332
  }
@@ -343,9 +342,8 @@ function updateIsActiveInHierarchyRecursiveRuntime(go: Object3D, activeInHierarc
343
342
 
344
343
  let success = true;
345
344
  if (go.children) {
346
- const nextLevel = level + 1;
347
345
  for (const ch of go.children) {
348
- const res = updateIsActiveInHierarchyRecursiveRuntime(ch, activeInHierarchy, allowEventCall, nextLevel);
346
+ const res = updateIsActiveInHierarchyRecursiveRuntime(ch, activeInHierarchy, allowEventCall, level + 1);
349
347
  if (res === false) success = false;
350
348
  }
351
349
  }
@@ -406,7 +406,7 @@ function checkObjectAssignments(obj: any, serializedData: any, implementationInf
406
406
  }
407
407
  const hasOtherKeys = value !== undefined && Object.keys(value).length > 1;
408
408
  if (!hasOtherKeys) {
409
- addLog(LogType.Warn, `<strong>Missing serialization for object reference!</strong>\n\nPlease change to: \n@serializable(Object3D)\n${key}? : Object3D;\n\nin script ${typeName}.ts\n<a href="https://docs.needle.tools/serializable" target="_blank">documentation</a>`);
409
+ addLog(LogType.Warn, `<strong>Missing serialization for object reference!</strong>\n\nPlease change to: \n@serializable(Object3D)\n${key}? : Object3D;\n\nin ${typeName}.ts\n<a href="https://docs.needle.tools/serializable" target="_blank">See documentation</a>`);
410
410
  console.warn(typeName, key, obj[key], obj);
411
411
  continue;
412
412
  }
@@ -1,4 +1,4 @@
1
- import type { QueryFilterFlags } from "@dimforge/rapier3d-compat";
1
+ import type { QueryFilterFlags, World } from "@dimforge/rapier3d-compat";
2
2
  import { AnimationClip, Color, Material, Mesh, Object3D, Quaternion } from "three";
3
3
  import { Vector3 } from "three";
4
4
  import { type GLTF as THREE_GLTF } from "three/examples/jsm/loaders/GLTFLoader.js";
@@ -442,80 +442,241 @@ export class SphereOverlapResult {
442
442
 
443
443
 
444
444
  export interface IPhysicsEngine {
445
+ /** Initializes the physics engine */
445
446
  initialize(): Promise<boolean>;
447
+ /** Indicates whether the physics engine has been initialized */
446
448
  get isInitialized(): boolean;
449
+ /** Advances physics simulation by the given time step */
447
450
  step(dt: number): void;
448
451
  postStep();
452
+ /** Indicates whether the physics engine is currently updating */
449
453
  get isUpdating(): boolean;
450
- /** clear all possibly cached data (e.g. mesh data when creating scaled mesh colliders) */
454
+ /** Clears all cached data (e.g., mesh data when creating scaled mesh colliders) */
451
455
  clearCaches();
452
456
 
457
+ /** Enables or disables the physics engine */
453
458
  enabled: boolean;
454
- get world(): any;
459
+ /** Returns the underlying physics world object */
460
+ get world(): World | undefined;
455
461
 
462
+ /** Sets the gravity vector for the physics simulation */
456
463
  set gravity(vec3: Vec3);
464
+ /** Gets the current gravity vector */
457
465
  get gravity(): Vec3;
458
466
 
459
- /** Get the rapier body for a Needle component */
467
+ /**
468
+ * Gets the rapier physics body for a Needle component
469
+ * @param obj The collider or rigidbody component
470
+ * @returns The underlying physics body or null if not found
471
+ */
460
472
  getBody(obj: ICollider | IRigidbody): null | any;
461
- /** Get the Needle Engine component for a rapier object */
473
+ /**
474
+ * Gets the Needle Engine component for a rapier physics object
475
+ * @param rapierObject The rapier physics object
476
+ * @returns The associated component or null if not found
477
+ */
462
478
  getComponent(rapierObject: object): IComponent | null;
463
479
 
464
- // raycasting
465
- /** Fast raycast against physics colliders
466
- * @param origin ray origin in screen or worldspace
467
- * @param direction ray direction in worldspace
468
- * @param options additional options
480
+ /**
481
+ * Performs a fast raycast against physics colliders
482
+ * @param origin Ray origin in screen or worldspace
483
+ * @param direction Ray direction in worldspace
484
+ * @param options Additional raycast configuration options
485
+ * @returns Raycast result containing hit point and collider, or null if no hit
469
486
  */
470
487
  raycast(origin?: Vec2 | Vec3, direction?: Vec3, options?: {
471
488
  maxDistance?: number,
472
489
  /** True if you want to also hit objects when the raycast starts from inside a collider */
473
490
  solid?: boolean,
474
491
  queryFilterFlags?: QueryFilterFlags,
475
- /** Raycast filter groups. Groups are used to apply the collision group rules for the scene query. The scene query will only consider hits with colliders with collision groups compatible with this collision group (using the bitwise test described in the collision groups section). See https://rapier.rs/docs/user_guides/javascript/colliders#collision-groups-and-solver-groups
476
- * For example membership 0x0001 and filter 0x0002 should be 0x00010002 */
492
+ /**
493
+ * Raycast filter groups. Groups are used to apply the collision group rules for the scene query.
494
+ * The scene query will only consider hits with colliders with collision groups compatible with
495
+ * this collision group (using the bitwise test described in the collision groups section).
496
+ * For example membership 0x0001 and filter 0x0002 should be 0x00010002
497
+ * @see https://rapier.rs/docs/user_guides/javascript/colliders#collision-groups-and-solver-groups
498
+ */
477
499
  filterGroups?: number,
478
- /** Return false to ignore this collider */
500
+ /**
501
+ * Predicate to filter colliders in raycast results
502
+ * @param collider The collider being tested
503
+ * @returns False to ignore this collider, true to include it
504
+ */
479
505
  filterPredicate?: (collider: ICollider) => boolean
480
506
  }): RaycastResult;
481
- /** raycast that also gets the normal vector. If you don't need it use raycast() */
507
+
508
+ /**
509
+ * Performs a raycast that also returns the normal vector at the hit point
510
+ * @param origin Ray origin in screen or worldspace
511
+ * @param direction Ray direction in worldspace
512
+ * @param options Additional raycast configuration options
513
+ * @returns Raycast result containing hit point, normal, and collider, or null if no hit
514
+ */
482
515
  raycastAndGetNormal(origin?: Vec2 | Vec3, direction?: Vec3, options?: {
483
516
  maxDistance?: number,
484
517
  /** True if you want to also hit objects when the raycast starts from inside a collider */
485
518
  solid?: boolean,
486
519
  queryFilterFlags?: QueryFilterFlags,
487
- /** Raycast filter groups. Groups are used to apply the collision group rules for the scene query. The scene query will only consider hits with colliders with collision groups compatible with this collision group (using the bitwise test described in the collision groups section). See https://rapier.rs/docs/user_guides/javascript/colliders#collision-groups-and-solver-groups
488
- * For example membership 0x0001 and filter 0x0002 should be 0x00010002 */
520
+ /**
521
+ * Raycast filter groups. Groups are used to apply the collision group rules for the scene query.
522
+ * The scene query will only consider hits with colliders with collision groups compatible with
523
+ * this collision group (using the bitwise test described in the collision groups section).
524
+ * For example membership 0x0001 and filter 0x0002 should be 0x00010002
525
+ * @see https://rapier.rs/docs/user_guides/javascript/colliders#collision-groups-and-solver-groups
526
+ */
489
527
  filterGroups?: number,
490
- /** Return false to ignore this collider */
528
+ /**
529
+ * Predicate to filter colliders in raycast results
530
+ * @param collider The collider being tested
531
+ * @returns False to ignore this collider, true to include it
532
+ */
491
533
  filterPredicate?: (collider: ICollider) => boolean
492
534
  }): RaycastResult;
535
+
536
+ /**
537
+ * Finds all colliders within a sphere
538
+ * @param point The center point of the sphere
539
+ * @param radius The radius of the sphere
540
+ * @returns Array of objects that overlap with the sphere
541
+ */
493
542
  sphereOverlap(point: Vector3, radius: number): Array<SphereOverlapResult>;
494
543
 
495
544
  // Collider methods
545
+ /**
546
+ * Adds a sphere collider to the physics world
547
+ * @param collider The collider component to add
548
+ */
496
549
  addSphereCollider(collider: ICollider);
550
+
551
+ /**
552
+ * Adds a box collider to the physics world
553
+ * @param collider The collider component to add
554
+ * @param size The size of the box
555
+ */
497
556
  addBoxCollider(collider: ICollider, size: Vector3);
557
+
558
+ /**
559
+ * Adds a capsule collider to the physics world
560
+ * @param collider The collider component to add
561
+ * @param radius The radius of the capsule
562
+ * @param height The height of the capsule
563
+ */
498
564
  addCapsuleCollider(collider: ICollider, radius: number, height: number);
565
+
566
+ /**
567
+ * Adds a mesh collider to the physics world
568
+ * @param collider The collider component to add
569
+ * @param mesh The mesh to use for collision
570
+ * @param convex Whether the collision mesh should be treated as convex
571
+ * @param scale Optional scale to apply to the mesh
572
+ */
499
573
  addMeshCollider(collider: ICollider, mesh: Mesh, convex: boolean, scale?: Vector3 | undefined);
500
574
 
575
+ /**
576
+ * Updates the physics material properties of a collider
577
+ * @param collider The collider to update
578
+ */
501
579
  updatePhysicsMaterial(collider: ICollider);
502
580
 
503
581
  // Rigidbody methods
582
+ /**
583
+ * Wakes up a sleeping rigidbody
584
+ * @param rb The rigidbody to wake up
585
+ */
504
586
  wakeup(rb: IRigidbody);
587
+
588
+ /**
589
+ * Checks if a rigidbody is currently sleeping
590
+ * @param rb The rigidbody to check
591
+ * @returns Whether the rigidbody is sleeping or undefined if cannot be determined
592
+ */
505
593
  isSleeping(rb: IRigidbody): boolean | undefined;
594
+
595
+ /**
596
+ * Updates the physical properties of a rigidbody or collider
597
+ * @param rb The rigidbody or collider to update
598
+ */
506
599
  updateProperties(rb: IRigidbody | ICollider);
600
+
601
+ /**
602
+ * Resets all forces acting on a rigidbody
603
+ * @param rb The rigidbody to reset forces on
604
+ * @param wakeup Whether to wake up the rigidbody
605
+ */
507
606
  resetForces(rb: IRigidbody, wakeup: boolean);
607
+
608
+ /**
609
+ * Resets all torques acting on a rigidbody
610
+ * @param rb The rigidbody to reset torques on
611
+ * @param wakeup Whether to wake up the rigidbody
612
+ */
508
613
  resetTorques(rb: IRigidbody, wakeup: boolean);
614
+
615
+ /**
616
+ * Adds a continuous force to a rigidbody
617
+ * @param rb The rigidbody to add force to
618
+ * @param vec The force vector to add
619
+ * @param wakeup Whether to wake up the rigidbody
620
+ */
509
621
  addForce(rb: IRigidbody, vec: Vec3, wakeup: boolean);
622
+
623
+ /**
624
+ * Applies an instantaneous impulse to a rigidbody
625
+ * @param rb The rigidbody to apply impulse to
626
+ * @param vec The impulse vector to apply
627
+ * @param wakeup Whether to wake up the rigidbody
628
+ */
510
629
  applyImpulse(rb: IRigidbody, vec: Vec3, wakeup: boolean);
511
- /** Returns the linear velocity of a rigidbody or the rigidbody of a collider */
630
+
631
+ /**
632
+ * Gets the linear velocity of a rigidbody or the rigidbody attached to a collider
633
+ * @param rb The rigidbody or collider to get velocity from
634
+ * @returns The linear velocity vector or null if not available
635
+ */
512
636
  getLinearVelocity(rb: IRigidbody | ICollider): Vec3 | null;
637
+
638
+ /**
639
+ * Gets the angular velocity of a rigidbody
640
+ * @param rb The rigidbody to get angular velocity from
641
+ * @returns The angular velocity vector or null if not available
642
+ */
513
643
  getAngularVelocity(rb: IRigidbody): Vec3 | null;
644
+
645
+ /**
646
+ * Sets the angular velocity of a rigidbody
647
+ * @param rb The rigidbody to set angular velocity for
648
+ * @param vec The angular velocity vector to set
649
+ * @param wakeup Whether to wake up the rigidbody
650
+ */
514
651
  setAngularVelocity(rb: IRigidbody, vec: Vec3, wakeup: boolean);
652
+
653
+ /**
654
+ * Sets the linear velocity of a rigidbody
655
+ * @param rb The rigidbody to set linear velocity for
656
+ * @param vec The linear velocity vector to set
657
+ * @param wakeup Whether to wake up the rigidbody
658
+ */
515
659
  setLinearVelocity(rb: IRigidbody, vec: Vec3, wakeup: boolean);
516
660
 
661
+ /**
662
+ * Updates the position and/or rotation of a physics body
663
+ * @param comp The collider or rigidbody component to update
664
+ * @param translation Whether to update the position
665
+ * @param rotation Whether to update the rotation
666
+ */
517
667
  updateBody(comp: ICollider | IRigidbody, translation: boolean, rotation: boolean);
668
+
669
+ /**
670
+ * Removes a physics body from the simulation
671
+ * @param body The component whose physics body should be removed
672
+ */
518
673
  removeBody(body: IComponent);
674
+
675
+ /**
676
+ * Gets the physics body for a component
677
+ * @param obj The collider or rigidbody component
678
+ * @returns The underlying physics body or null if not found
679
+ */
519
680
  getBody(obj: ICollider | IRigidbody): null | any;
520
681
 
521
682
  // Joints
@@ -693,7 +693,13 @@ export class NeedleXRSession implements INeedleXRSession {
693
693
  }
694
694
  private _rigScale: number = 1;
695
695
  private _lastRigScaleUpdate: number = -1;
696
- /** get the XR rig worldscale */
696
+
697
+ /** Get the XR Rig worldscale.
698
+ *
699
+ * **For AR**
700
+ * If you want to modify the scale in AR at runtime get the WebARSessionRoot component via `findObjectOfType(WebARSessionRoot)` and then set the `arScale` value.
701
+ *
702
+ */
697
703
  get rigScale() {
698
704
  if (!this._rigs[0]) return 1;
699
705
  if (this._lastRigScaleUpdate !== this.context.time.frame) {