@needle-tools/engine 4.2.2 → 4.2.4

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 (56) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/gltf-progressive.js +258 -257
  3. package/dist/gltf-progressive.light.js +258 -257
  4. package/dist/gltf-progressive.light.min.js +7 -7
  5. package/dist/gltf-progressive.light.umd.cjs +7 -7
  6. package/dist/gltf-progressive.min.js +7 -7
  7. package/dist/gltf-progressive.umd.cjs +7 -7
  8. package/dist/needle-engine.bundle.js +7127 -7089
  9. package/dist/needle-engine.bundle.light.js +7123 -7085
  10. package/dist/needle-engine.bundle.light.min.js +133 -133
  11. package/dist/needle-engine.bundle.light.umd.cjs +136 -136
  12. package/dist/needle-engine.bundle.min.js +133 -133
  13. package/dist/needle-engine.bundle.umd.cjs +136 -136
  14. package/lib/engine/engine_context.d.ts +1 -0
  15. package/lib/engine/engine_context.js +7 -3
  16. package/lib/engine/engine_context.js.map +1 -1
  17. package/lib/engine/engine_input.d.ts +3 -3
  18. package/lib/engine/engine_input.js.map +1 -1
  19. package/lib/engine/engine_loaders.js +6 -12
  20. package/lib/engine/engine_loaders.js.map +1 -1
  21. package/lib/engine/engine_physics_rapier.js +1 -1
  22. package/lib/engine/engine_physics_rapier.js.map +1 -1
  23. package/lib/engine/engine_three_utils.js +1 -1
  24. package/lib/engine/engine_three_utils.js.map +1 -1
  25. package/lib/engine/engine_utils_screenshot.js +2 -0
  26. package/lib/engine/engine_utils_screenshot.js.map +1 -1
  27. package/lib/engine-components/Collider.d.ts +3 -2
  28. package/lib/engine-components/Collider.js +24 -3
  29. package/lib/engine-components/Collider.js.map +1 -1
  30. package/lib/engine-components/OrbitControls.d.ts +9 -2
  31. package/lib/engine-components/OrbitControls.js +75 -19
  32. package/lib/engine-components/OrbitControls.js.map +1 -1
  33. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +6 -2
  34. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -1
  35. package/lib/engine-components/export/usdz/extensions/Animation.js +10 -6
  36. package/lib/engine-components/export/usdz/extensions/Animation.js.map +1 -1
  37. package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js +1 -1
  38. package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js.map +1 -1
  39. package/lib/engine-components/ui/InputField.d.ts +1 -0
  40. package/lib/engine-components/ui/InputField.js +11 -0
  41. package/lib/engine-components/ui/InputField.js.map +1 -1
  42. package/package.json +3 -3
  43. package/plugins/types/userconfig.d.ts +2 -2
  44. package/plugins/vite/pwa.js +33 -22
  45. package/src/engine/engine_context.ts +7 -3
  46. package/src/engine/engine_input.ts +3 -3
  47. package/src/engine/engine_loaders.ts +6 -10
  48. package/src/engine/engine_physics_rapier.ts +1 -1
  49. package/src/engine/engine_three_utils.ts +1 -1
  50. package/src/engine/engine_utils_screenshot.ts +2 -0
  51. package/src/engine-components/Collider.ts +29 -5
  52. package/src/engine-components/OrbitControls.ts +82 -21
  53. package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +9 -5
  54. package/src/engine-components/export/usdz/extensions/Animation.ts +12 -8
  55. package/src/engine-components/export/usdz/extensions/behavior/Behaviour.ts +1 -1
  56. package/src/engine-components/ui/InputField.ts +9 -0
@@ -20,6 +20,17 @@ export class InputField extends Behaviour {
20
20
  get text() {
21
21
  return this.textComponent?.text ?? "";
22
22
  }
23
+ set text(value) {
24
+ if (this.textComponent) {
25
+ this.textComponent.text = value;
26
+ if (this.placeholder) {
27
+ if (value.length > 0)
28
+ this.placeholder.gameObject.visible = false;
29
+ else
30
+ this.placeholder.gameObject.visible = true;
31
+ }
32
+ }
33
+ }
23
34
  get isFocused() {
24
35
  return InputField.active === this;
25
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InputField.js","sourceRoot":"","sources":["../../../src/engine-components/ui/InputField.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gDAA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QAC5C,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;QACvB,MAAM,SAAS,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,SAAS,EAAE,UAAU,KAAK,IAAI,CAAC,UAAU,IAAI,SAAS,EAAE,UAAU,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU;YAC7F,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAChC,CAAC;;AA/OD;IADC,YAAY,CAAC,IAAI,CAAC;iDACU;AAG7B;IADC,YAAY,CAAC,IAAI,CAAC;+CACQ;AAG3B;IADC,YAAY,CAAC,SAAS,CAAC;kDACQ;AAGhC;IADC,YAAY,CAAC,SAAS,CAAC;6CACG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "4.2.2",
3
+ "version": "4.2.4",
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": {
@@ -86,7 +86,7 @@
86
86
  ],
87
87
  "dependencies": {
88
88
  "@dimforge/rapier3d-compat": "^0.14.0",
89
- "@needle-tools/gltf-progressive": "^2.1.0",
89
+ "@needle-tools/gltf-progressive": "^2.1.1",
90
90
  "@webxr-input-profiles/motion-controllers": "^1.0.0",
91
91
  "flatbuffers": "2.0.4",
92
92
  "md5": "^2.3.0",
@@ -95,7 +95,7 @@
95
95
  "postprocessing": "^6.36.6",
96
96
  "simplex-noise": "^4.0.1",
97
97
  "stats.js": "^0.17.0",
98
- "three": "npm:@needle-tools/three@^0.169.4",
98
+ "three": "npm:@needle-tools/three@^0.169.5",
99
99
  "three-mesh-bvh": "^0.8.3",
100
100
  "three-mesh-ui": "npm:@needle-tools/three-mesh-ui@^7.1.5-alpha.5",
101
101
  "three.quarks": "0.15.6",
@@ -85,8 +85,8 @@ export type userSettings = {
85
85
  */
86
86
  posterGenerationMode?: "default" | "once";
87
87
 
88
- /** Pass in a mix of VitePWA and NeedlePWA options, or "false" */
89
- /** @type {import("vite-plugin-pwa").VitePWAOptions & Partial<NeedlePWAOptions> | false} */
88
+ /** Pass in a mix of VitePWA and NeedlePWA options, true to enable with defaults or "false" to disable */
89
+ /** @type {import("vite-plugin-pwa").VitePWAOptions & Partial<NeedlePWAOptions> | boolean} */
90
90
  pwa?: undefined;
91
91
 
92
92
  /** used by nextjs config to forward the webpack module */
@@ -4,6 +4,7 @@ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync,
4
4
  import { getOutputDirectory } from './config.js';
5
5
  import { getPosterPath } from './poster.js';
6
6
 
7
+ const pwaErrorWithInstructions = "It seems that you're trying to build a PWA using 'vite-plugin-pwa'!\nNeedle can manage PWA settings for you – just pass the same 'pwaOptions' to the needlePlugins and VitePWA plugins:\n\n1. Install the vite PWA plugin: npm install vite-plugin-pwa --save-dev\n\n2. Then update your vite.config.js:\n\n import { VitePWA } from 'vite-plugin-pwa';\n ...\n needlePlugins(command, needleConfig, { pwa: pwaOptions }),\n VitePWA(pwaOptions),\n\nIf you want to manage PWA building yourself and skip this check, please pass '{ pwa: false }' to needlePlugins.";
7
8
 
8
9
  /** Provides reasonable defaults for a PWA manifest and workbox settings.
9
10
  * @param {import('../types').userSettings} userSettings
@@ -13,7 +14,9 @@ import { getPosterPath } from './poster.js';
13
14
  export const needlePWA = (command, config, userSettings) => {
14
15
  // @ts-ignore // TODO correctly type the userSettings.pwaOptions object
15
16
  /** @type {import("vite-plugin-pwa").VitePWAOptions | false} */
16
- const pwaOptions = userSettings.pwa;
17
+ const pwaOptions = userSettings.pwa === true
18
+ ? { } // allow setting `pwa: true`
19
+ : userSettings.pwa;
17
20
 
18
21
  /** The context contains files that are generated by the plugin and should be deleted after
19
22
  * @type {import('../types').NeedlePWAProcessContext} */
@@ -29,7 +32,7 @@ export const needlePWA = (command, config, userSettings) => {
29
32
  apply: "build",
30
33
  configResolved(viteConfig) {
31
34
  if (findVitePWAPlugin(viteConfig)) {
32
- errorThrow("It seems that you're trying to build a PWA using `vite-plugin-pwa`!\nNeedle can manage PWA settings for you – just pass the same `pwaOptions` to the `needlePlugin` and `VitePWA` plugins:\n\n import { VitePWA } from 'vite-plugin-pwa';\n ...\n needlePlugins(command, needleConfig, { pwa: pwaOptions }),\n VitePWA(pwaOptions),\n\nIf you want to manage PWA building yourself and skip this check, please pass `{ pwa: false }` to needlePlugins.");
35
+ errorThrow(pwaErrorWithInstructions);
33
36
  }
34
37
  },
35
38
  }
@@ -88,7 +91,7 @@ export const needlePWA = (command, config, userSettings) => {
88
91
  let pwaPluginIndex = -1;
89
92
  let gzipPlugin = null;
90
93
  if (viteConfig.plugins) {
91
- for (let i = viteConfig.plugins.length-1; i >= 0; i--) {
94
+ for (let i = viteConfig.plugins.length - 1; i >= 0; i--) {
92
95
  const plugin = viteConfig.plugins[i];
93
96
  if (plugin && "name" in plugin && plugin.name === "vite:compression") {
94
97
  gzipPluginIndex = i;
@@ -152,7 +155,7 @@ export const needlePWA = (command, config, userSettings) => {
152
155
  try {
153
156
  const plugin = findVitePWAPlugin(config);
154
157
  if (!plugin) {
155
- errorThrow("It seems that you're trying to build a PWA!.\nRun `npm install vite-plugin-pwa --save-dev` to install the plugin\nThen add VitePWA to your vite.config.js and pass the pwaOptions to both Needle and VitePWA:\n\n import { VitePWA } from 'vite-plugin-pwa';\n \n const pwaOptions = {};\n \n plugins: [\n needlePlugins(command, needleConfig, { pwa: pwaOptions }),\n VitePWA(pwaOptions),\n ]\n\nIf you don't intend to build a PWA, pass `{ pwa: false }` to needlePlugins or remove the `pwa` entry.");
158
+ errorThrow(pwaErrorWithInstructions);
156
159
  }
157
160
 
158
161
  // check if the index header contains the webmanifest ALSO
@@ -547,28 +550,36 @@ function processWorkboxConfig(manifest) {
547
550
  ],
548
551
  runtimeCaching: [
549
552
  // allow caching Google Fonts
550
- {...externalResourceCaching, ...{
551
- urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
552
- options: { cacheName: 'google-fonts-cache' },
553
- }},
553
+ {
554
+ ...externalResourceCaching, ...{
555
+ urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
556
+ options: { cacheName: 'google-fonts-cache' },
557
+ }
558
+ },
554
559
  // allow caching static resources from Google, like CSS
555
- {...externalResourceCaching, ...{
556
- urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
557
- options: { cacheName: 'gstatic-fonts-cache' },
558
- }},
560
+ {
561
+ ...externalResourceCaching, ...{
562
+ urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
563
+ options: { cacheName: 'gstatic-fonts-cache' },
564
+ }
565
+ },
559
566
  // allow caching Needle cdn resources
560
- {...externalResourceCaching, ...{
561
- urlPattern: /^https:\/\/cdn\.needle\.tools\/.*/i,
562
- handler: 'NetworkFirst',
563
- options: { cacheName: 'needle-cdn-cache' },
564
- }},
567
+ {
568
+ ...externalResourceCaching, ...{
569
+ urlPattern: /^https:\/\/cdn\.needle\.tools\/.*/i,
570
+ handler: 'NetworkFirst',
571
+ options: { cacheName: 'needle-cdn-cache' },
572
+ }
573
+ },
565
574
  // allow caching controller resources,
566
575
  // https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/
567
- {...externalResourceCaching, ...{
568
- urlPattern: /^https:\/\/cdn\.jsdelivr\.net\/npm\/@webxr-input-profiles\/assets@1\.0\/dist\/profiles\/.*/i,
569
- handler: 'NetworkFirst',
570
- options: { cacheName: 'webxr-controller-cache' },
571
- }},
576
+ {
577
+ ...externalResourceCaching, ...{
578
+ urlPattern: /^https:\/\/cdn\.jsdelivr\.net\/npm\/@webxr-input-profiles\/assets@1\.0\/dist\/profiles\/.*/i,
579
+ handler: 'NetworkFirst',
580
+ options: { cacheName: 'webxr-controller-cache' },
581
+ }
582
+ },
572
583
  // allow caching local resources
573
584
  {
574
585
  urlPattern: ({ url }) => url,
@@ -1468,10 +1468,14 @@ export class Context implements IContext {
1468
1468
  return true;
1469
1469
  }
1470
1470
 
1471
+ private _contextRestoreTries = 0;
1471
1472
  private handleRendererContextLost() {
1472
- if (this.renderer.getContext().isContextLost()) {
1473
- console.warn("Attempting to recover WebGL context...");
1474
- this.renderer.forceContextRestore();
1473
+ // Try to restore the context every x frames
1474
+ if (this.time.frame % 10 && this.renderer.getContext().isContextLost()) {
1475
+ if (this._contextRestoreTries++ < 100) {
1476
+ console.warn("Attempting to recover WebGL context...");
1477
+ this.renderer.forceContextRestore();
1478
+ }
1475
1479
  }
1476
1480
  }
1477
1481
 
@@ -655,7 +655,7 @@ export class Input implements IInput {
655
655
  }
656
656
  return null;
657
657
  }
658
- isKeyDown(keyCode: KeyCode | string) {
658
+ isKeyDown(keyCode: KeyCode | ({} & string)) {
659
659
  if (!this.context.application.isVisible || !this.context.application.hasFocus) return false;
660
660
  const codes = this.getCodeForCommonKeyName(keyCode);
661
661
  if (codes !== null) {
@@ -664,7 +664,7 @@ export class Input implements IInput {
664
664
  }
665
665
  return this.keysPressed[keyCode]?.startFrame === this.context.time.frameCount && this.keysPressed[keyCode].pressed;
666
666
  }
667
- isKeyUp(keyCode: KeyCode | string) {
667
+ isKeyUp(keyCode: KeyCode | ({} & string)) {
668
668
  if (!this.context.application.isVisible || !this.context.application.hasFocus) return false;
669
669
  const codes = this.getCodeForCommonKeyName(keyCode);
670
670
  if (codes !== null) {
@@ -673,7 +673,7 @@ export class Input implements IInput {
673
673
  }
674
674
  return this.keysPressed[keyCode]?.frame === this.context.time.frameCount && !this.keysPressed[keyCode].pressed;
675
675
  }
676
- isKeyPressed(keyCode: KeyCode | string) {
676
+ isKeyPressed(keyCode: KeyCode | ({} & string)) {
677
677
  if (!this.context.application.isVisible || !this.context.application.hasFocus) return false;
678
678
  const codes = this.getCodeForCommonKeyName(keyCode);
679
679
  if (codes !== null) {
@@ -23,26 +23,22 @@ function ensureLoaders() {
23
23
  export function setDracoDecoderPath(path: string | undefined) {
24
24
  if (path !== undefined && typeof path === "string") {
25
25
  setDracoDecoderLocation(path);
26
- const loaders = ensureLoaders();
27
- if (debug) console.log("Setting draco decoder path to", path);
28
- loaders.dracoLoader.setDecoderPath(path);
29
26
  }
30
27
  }
31
28
 
32
29
  export function setDracoDecoderType(type: string | undefined) {
33
30
  if (type !== undefined && typeof type === "string") {
34
- const loaders = ensureLoaders();
35
- if (debug) console.log("Setting draco decoder type to", type);
36
- loaders.dracoLoader.setDecoderConfig({ type: type });
31
+ if (type !== "js") {
32
+ const loaders = ensureLoaders();
33
+ if (debug) console.log("Setting draco decoder type to", type);
34
+ loaders.dracoLoader.setDecoderConfig({ type: type });
35
+ }
37
36
  }
38
37
  }
39
38
 
40
39
  export function setKtx2TranscoderPath(path: string) {
41
40
  if (path !== undefined && typeof path === "string") {
42
41
  setKTX2TranscoderLocation(path);
43
- const loaders = ensureLoaders();
44
- if (debug) console.log("Setting ktx2 transcoder path to", path);
45
- loaders.ktx2Loader.setTranscoderPath(path);
46
42
  }
47
43
  }
48
44
 
@@ -78,7 +74,7 @@ export function addDracoAndKTX2Loaders(loader: GLTFLoader, context: Pick<Context
78
74
  if (!(loader as any).meshoptDecoder)
79
75
  loader.setMeshoptDecoder(loaders.meshoptDecoder);
80
76
 
81
- configureLoader(loader, {
77
+ configureLoader(loader, {
82
78
  progressive: true,
83
79
  });
84
80
 
@@ -710,7 +710,7 @@ export class RapierPhysics implements IPhysicsEngine {
710
710
  positions = this._meshCache.get(key)!;
711
711
  }
712
712
  else {
713
- if (debugPhysics || isDevEnvironment()) console.warn(`Your MeshCollider \"${collider.name}\" is scaled: consider applying the scale to the collider mesh instead (${scale.x}, ${scale.y}, ${scale.z})`);
713
+ if (debugPhysics || isDevEnvironment()) console.debug(`[Performance] Your MeshCollider \"${collider.name}\" is scaled: consider applying the scale to the collider mesh instead (${scale.x}, ${scale.y}, ${scale.z})`);
714
714
  const scaledPositions = new Float32Array(positions.length);
715
715
  for (let i = 0; i < positions.length; i += 3) {
716
716
  scaledPositions[i] = positions[i] * scale.x;
@@ -728,7 +728,7 @@ export function postprocessFBXMaterials(obj: Mesh, material: Material | Material
728
728
  }
729
729
 
730
730
  // ignore if the material is already a MeshStandardMaterial
731
- if (material.type === "MeshStandardMaterial") {
731
+ if (material.type === "MeshStandardMaterial" || material.type === "MeshBasicMaterial") {
732
732
  return false;
733
733
  }
734
734
  // check if the material was already processed
@@ -3,6 +3,7 @@ import { Camera, Color, ColorRepresentation, FrontSide, Mesh, MirroredRepeatWrap
3
3
  import { GameObject } from "../engine-components/Component.js";
4
4
  import { Renderer } from "../engine-components/Renderer.js";
5
5
  import { WebARCameraBackground } from "../engine-components/webxr/WebARCameraBackground.js";
6
+ import { setAutoFitEnabled } from "./engine_camera.js";
6
7
  import { getComponentsInChildren } from "./engine_components.js";
7
8
  import { ContextRegistry } from "./engine_context_registry.js";
8
9
  import { onAfterRender } from "./engine_lifecycle_api.js";
@@ -669,6 +670,7 @@ void main() {
669
670
  });
670
671
 
671
672
  const planeMesh = new Mesh(new PlaneGeometry(2, 2), planeMaterial,) as unknown as FullscreenPlane;
673
+ setAutoFitEnabled(planeMesh, false);
672
674
  planeMesh.geometry.deleteAttribute('normal');
673
675
  // Option 1: add the planeMesh to our scene for rendering.
674
676
  // This is useful for applying custom shader effects on the background (instead of using the system composite)
@@ -1,9 +1,10 @@
1
1
  import { BufferGeometry, Group, Mesh, Object3D, Vector3 } from "three"
2
2
 
3
3
  import { addComponent } from "../engine/engine_components.js";
4
+ import { Gizmos } from "../engine/engine_gizmos.js";
4
5
  import type { PhysicsMaterial } from "../engine/engine_physics.types.js";
5
6
  import { serializable } from "../engine/engine_serialization_decorator.js";
6
- import { getWorldScale } from "../engine/engine_three_utils.js";
7
+ import { getBoundingBox, getWorldScale } from "../engine/engine_three_utils.js";
7
8
  // import { IColliderProvider, registerColliderProvider } from "../engine/engine_physics.js";
8
9
  import type { IBoxCollider, ICollider, ISphereCollider } from "../engine/engine_types.js";
9
10
  import { validate } from "../engine/engine_util_decorator.js";
@@ -92,7 +93,7 @@ export class Collider extends Behaviour implements ICollider {
92
93
  }
93
94
 
94
95
  /** Requests an update of the physics material in the physics engine */
95
- updatePhysicsMaterial(){
96
+ updatePhysicsMaterial() {
96
97
  this.context.physics.engine?.updatePhysicsMaterial(this);
97
98
 
98
99
  }
@@ -135,13 +136,36 @@ export class SphereCollider extends Collider implements ISphereCollider {
135
136
  */
136
137
  export class BoxCollider extends Collider implements IBoxCollider {
137
138
 
138
- static add(obj: Mesh, opts?: { rigidbody: boolean }) {
139
+ static add(obj: Mesh | Object3D, opts?: { rigidbody: boolean, debug?: boolean }) {
139
140
  const collider = new BoxCollider();
140
141
 
141
- if (!obj.geometry.boundingBox) obj.geometry.computeBoundingBox();
142
- const bb = obj.geometry.boundingBox!;
142
+ // we need to transform the object into identity
143
+ // because the physics collider will correctly apple the object's transform again
144
+ // if we don't do it here we will have the transform applied twice
145
+ const originalPosition = obj.position.clone();
146
+ const originalQuaternion = obj.quaternion.clone();
147
+ const originalScale = obj.scale.clone();
148
+ obj.position.set(0, 0, 0);
149
+ obj.quaternion.set(0, 0, 0, 1);
150
+ obj.scale.set(1, 1, 1);
151
+ const bb = getBoundingBox([obj]);
152
+ obj.position.copy(originalPosition);
153
+ obj.quaternion.copy(originalQuaternion);
154
+ obj.scale.copy(originalScale);
155
+
156
+ if(opts?.debug) Gizmos.DrawWireBox3(bb, 0xffdd00, 20);
157
+
158
+ // if (!obj.geometry.boundingBox) obj.geometry.computeBoundingBox();
159
+ // const bb = obj.geometry.boundingBox!;
143
160
  collider.size = bb!.getSize(new Vector3()) || new Vector3(1, 1, 1);
144
161
  collider.center = bb!.getCenter(new Vector3()) || new Vector3(0, 0, 0);
162
+ if (collider.size.length() <= 0) {
163
+ collider.size.set(0.01, 0.01, 0.01);
164
+ }
165
+
166
+ // collider.center.sub(obj.position);
167
+ // collider.size.applyQuaternion(obj.worldQuaternion);
168
+
145
169
  addComponent(obj, collider);
146
170
 
147
171
  if (opts?.rigidbody === true) {
@@ -1,13 +1,14 @@
1
- import { Box3Helper, Object3D, PerspectiveCamera, Ray, Vector2, Vector3, Vector3Like } from "three";
1
+ import { Box3Helper, Euler, Object3D, PerspectiveCamera, Quaternion, Ray, Vector2, Vector3, Vector3Like } from "three";
2
2
  import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
3
3
 
4
+ import { isDevEnvironment } from "../engine/debug/index.js";
4
5
  import { setCameraController } from "../engine/engine_camera.js";
5
6
  import { Gizmos } from "../engine/engine_gizmos.js";
6
7
  import { InputEventQueue, NEPointerEvent } from "../engine/engine_input.js";
7
8
  import { Mathf } from "../engine/engine_math.js";
8
9
  import { RaycastOptions } from "../engine/engine_physics.js";
9
10
  import { serializable } from "../engine/engine_serialization_decorator.js";
10
- import { getBoundingBox, getWorldDirection, getWorldPosition, getWorldRotation, setWorldRotation } from "../engine/engine_three_utils.js";
11
+ import { getBoundingBox, getTempVector, getWorldDirection, getWorldPosition, getWorldRotation, setWorldRotation } from "../engine/engine_three_utils.js";
11
12
  import type { ICameraController } from "../engine/engine_types.js";
12
13
  import { DeviceUtilities, getParam } from "../engine/engine_utils.js";
13
14
  import { Camera } from "./Camera.js";
@@ -403,6 +404,16 @@ export class OrbitControls extends Behaviour implements ICameraController {
403
404
  if (this.doubleClickToFocus && evt.isDoubleClick && !evt.used) {
404
405
  this.setTargetFromRaycast();
405
406
  }
407
+ // Automatically update the camera focus
408
+ else if (!evt.used && this.autoTarget) {
409
+ const ray = new Ray(this._cameraObject?.worldPosition, this._cameraObject?.worldForward.multiplyScalar(-1));
410
+ const hits = this.context.physics.raycastFromRay(ray);
411
+ const hit = hits.length > 0 ? hits[0] : undefined;
412
+ if(hit && hit.distance > this.minZoom && hit.distance < this.maxZoom) {
413
+ if(debug) Gizmos.DrawWireSphere(hit.point, 0.1, 0xff0000, 2);
414
+ this._controls?.target.copy(hits[0].point);
415
+ }
416
+ }
406
417
  };
407
418
 
408
419
  private onControlsChangeStarted = () => {
@@ -616,14 +627,38 @@ export class OrbitControls extends Behaviour implements ICameraController {
616
627
 
617
628
 
618
629
  /**
619
- * Sets camera target position and look direction. Does perform a raycast in the forward direction of the passed in object to find an orbit point
630
+ * Sets camera target position and look direction using a raycast in forward direction of the object.
631
+ *
632
+ * @param source The object to raycast from. If a camera is passed in the camera position will be used as the source.
633
+ * @param immediateOrDuration If true the camera target will move immediately to the new position, otherwise it will lerp. If a number is passed in it will be used as the duration of the lerp.
634
+ *
635
+ * This is useful for example if you want to align your camera with an object in your scene (or another camera). Simply pass in this other camera object
636
+ * @returns true if the target was set successfully
620
637
  */
621
- public setCameraAndLookTarget(target: Object3D) {
622
- if (!target || !(target instanceof Object3D)) return;
623
- const worldPosition = getWorldPosition(target);
624
- const forward = getWorldDirection(target);
625
- this.setTargetFromRaycast(new Ray(worldPosition, forward));
626
- this.setCameraTargetPosition(worldPosition);
638
+ public setCameraAndLookTarget(source: Object3D | Camera, immediateOrDuration: number | boolean = false): boolean {
639
+ if (!source) {
640
+ if (isDevEnvironment()) console.warn("[OrbitControls] setCameraAndLookTarget target is null");
641
+ return false;
642
+ }
643
+ if (!(source instanceof Object3D) && !(source instanceof Camera)) {
644
+ if (isDevEnvironment()) console.warn("[OrbitControls] setCameraAndLookTarget target is not an Object3D or Camera");
645
+ return false;
646
+ }
647
+ if (source instanceof Camera) {
648
+ source = source.gameObject;
649
+ }
650
+ const worldPosition = source.worldPosition;
651
+ const forward = source.worldForward;
652
+ const ray = new Ray(worldPosition, forward.multiplyScalar(-1));
653
+
654
+ if (debug) Gizmos.DrawRay(ray.origin, ray.direction, 0xff0000, 10);
655
+
656
+ if (!this.setTargetFromRaycast(ray, immediateOrDuration)) {
657
+ this.setLookTargetPosition(ray.at(2, getTempVector()), immediateOrDuration);
658
+ }
659
+
660
+ this.setCameraTargetPosition(worldPosition, immediateOrDuration);
661
+ return true;
627
662
  }
628
663
 
629
664
  /** Moves the camera to position smoothly.
@@ -653,6 +688,38 @@ export class OrbitControls extends Behaviour implements ICameraController {
653
688
  else this._cameraLerpDuration = this.targetLerpDuration;
654
689
  }
655
690
  }
691
+ // public setCameraTargetRotation(rotation: Vector3 | Euler | Quaternion, immediateOrDuration: boolean | number = false): void {
692
+ // if (!this._cameraObject) return;
693
+
694
+ // if (typeof immediateOrDuration === "boolean") immediateOrDuration = immediateOrDuration ? 0 : this.targetLerpDuration;
695
+
696
+ // const ray = new Ray(this._cameraObject.worldPosition, getTempVector(0, 0, 1));
697
+
698
+ // // if the camera is in the middle of lerping we use the end position for the raycast
699
+ // if (immediateOrDuration > 0 && this._cameraEndPosition && this._cameraLerpActive) {
700
+ // ray.origin = getTempVector(this._cameraEndPosition)
701
+ // }
702
+
703
+ // if (rotation instanceof Vector3) {
704
+ // rotation = new Euler().setFromVector3(rotation);
705
+ // }
706
+ // if (rotation instanceof Euler) {
707
+ // rotation = new Quaternion().setFromEuler(rotation);
708
+ // }
709
+
710
+ // ray.direction.applyQuaternion(rotation);
711
+ // ray.direction.multiplyScalar(-1);
712
+
713
+ // const hits = this.context.physics.raycastFromRay(ray);
714
+
715
+ // if (hits.length > 0) {
716
+ // this.setCameraTargetPosition(hits[0].point, immediateOrDuration);
717
+ // }
718
+ // else {
719
+ // this.setLookTargetPosition(ray.at(2, getTempVector()));
720
+ // }
721
+ // }
722
+
656
723
  /** True while the camera position is being lerped */
657
724
  get cameraLerpActive() { return this._cameraLerpActive; }
658
725
  /** Call to stop camera position lerping */
@@ -726,6 +793,7 @@ export class OrbitControls extends Behaviour implements ICameraController {
726
793
  */
727
794
  private setLookTargetFromConstraint(index: number = 0, t: number = 1): boolean {
728
795
  if (!this._controls) return false;
796
+ if (this.lookAtConstraint?.enabled === false) return false;
729
797
  const sources = this.lookAtConstraint?.sources;
730
798
  if (sources && sources.length > 0) {
731
799
  const target = sources[index];
@@ -747,8 +815,8 @@ export class OrbitControls extends Behaviour implements ICameraController {
747
815
  else this._controls.target.lerp(position, delta);
748
816
  }
749
817
 
750
- private setTargetFromRaycast(ray?: Ray) {
751
- if (!this.controls) return;
818
+ private setTargetFromRaycast(ray?: Ray, immediateOrDuration: number | boolean = false): boolean {
819
+ if (!this.controls) return false;
752
820
  const rc = ray ? this.context.physics.raycastFromRay(ray) : this.context.physics.raycast();
753
821
  for (const hit of rc) {
754
822
  if (hit.distance > 0 && GameObject.isActiveInHierarchy(hit.object)) {
@@ -760,18 +828,11 @@ export class OrbitControls extends Behaviour implements ICameraController {
760
828
  break;
761
829
  }
762
830
  }
763
-
764
- this.setLookTargetPosition(hit.point);
765
-
766
- // if (this.context.mainCamera) {
767
- // const pos = getWorldPosition(this.context.mainCamera);
768
- // const cameraTarget = pos.clone().sub(this.controls.target).add(this._lookTargetEndPosition);
769
- // this._cameraObject?.parent?.worldToLocal(cameraTarget);
770
- // this.setCameraTargetPosition(cameraTarget);
771
- // }
772
- break;
831
+ this.setLookTargetPosition(hit.point, immediateOrDuration);
832
+ return true;
773
833
  }
774
834
  }
835
+ return false;
775
836
  }
776
837
 
777
838
  // Adapted from https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/24
@@ -1659,15 +1659,17 @@ function buildMesh( geometry: BufferGeometry, bones: Bone[] = [], quickLookCompa
1659
1659
  let bonesArray = "";
1660
1660
  if (hasBones) {
1661
1661
  const uuidsFound:string[] = [];
1662
- for(const bone of bones ){
1663
- if (bone.parent!.type !== 'Bone'){
1662
+ for (const bone of bones ) {
1663
+ // if (bone.parent!.type !== 'Bone')
1664
+ {
1664
1665
  sortedBones.push({bone: bone, index: bones.indexOf(bone)});
1665
1666
  uuidsFound.push(bone.uuid);
1666
1667
  }
1667
1668
  }
1668
1669
 
1669
- while (uuidsFound.length < bones.length){
1670
- for(const sortedBone of sortedBones){
1670
+ let maxSteps = 10_000;
1671
+ while (uuidsFound.length < bones.length && maxSteps-- > 0) {
1672
+ for (const sortedBone of sortedBones) {
1671
1673
  const children = sortedBone.bone.children as Bone[];
1672
1674
  for (const childBone of children){
1673
1675
  if (uuidsFound.indexOf(childBone.uuid) === -1 && bones.indexOf(childBone) !== -1){
@@ -1678,8 +1680,10 @@ function buildMesh( geometry: BufferGeometry, bones: Bone[] = [], quickLookCompa
1678
1680
  }
1679
1681
  }
1680
1682
 
1683
+ if (maxSteps <= 0) console.error("Failed to sort bones in skinned mesh", sortedBones, bones, uuidsFound);
1684
+
1681
1685
  // add structural nodes to the list of bones
1682
- for ( const structuralNode of findStructuralNodesInBoneHierarchy(bones) ) {
1686
+ for (const structuralNode of findStructuralNodesInBoneHierarchy(bones) ) {
1683
1687
  sortedBones.push( { bone: structuralNode, index: sortedBones.length } );
1684
1688
  }
1685
1689
 
@@ -662,31 +662,35 @@ class SerializeAnimation {
662
662
 
663
663
  const sortedBones:Bone[] = [];
664
664
  const uuidsFound:string[] = [];
665
- for(const bone of skeleton.bones ){
666
- if (bone.parent!.type !== 'Bone'){
665
+ for(const bone of skeleton.bones ) {
666
+ // if (bone.parent!.type !== 'Bone')
667
+ {
667
668
  sortedBones.push(bone);
669
+ uuidsFound.push(bone.uuid);
668
670
  const inverse = skeleton.boneInverses[skeleton.bones.indexOf(bone)];
669
671
  boneAndInverse.push({bone, inverse});
670
- uuidsFound.push(bone.uuid);
671
672
  }
672
673
  }
673
674
 
674
- while (uuidsFound.length < skeleton.bones.length){
675
- for(const sortedBone of sortedBones){
675
+ let maxSteps = 10_000;
676
+ while (uuidsFound.length < skeleton.bones.length && maxSteps-- > 0) {
677
+ for (const sortedBone of sortedBones){
676
678
  const children = sortedBone.children as Bone[];
677
679
  for (const childBone of children){
678
680
  if (uuidsFound.indexOf(childBone.uuid) === -1 && skeleton.bones.indexOf(childBone) !== -1){
679
681
  sortedBones.push(childBone);
682
+ uuidsFound.push(childBone.uuid);
680
683
  const childInverse = skeleton.boneInverses[skeleton.bones.indexOf(childBone)];
681
684
  boneAndInverse.push({bone: childBone, inverse: childInverse});
682
- uuidsFound.push(childBone.uuid);
683
685
  }
684
686
  }
685
687
  }
686
688
  }
687
689
 
688
- for (const bone of findStructuralNodesInBoneHierarchy(skeleton.bones)) {
689
- boneAndInverse.push({bone, inverse: bone.matrixWorld.clone().invert()});
690
+ if (maxSteps <= 0) console.error("Failed to sort bones in skinned mesh", model.skinnedMesh, skeleton.bones, uuidsFound);
691
+
692
+ for (const structuralNode of findStructuralNodesInBoneHierarchy(skeleton.bones)) {
693
+ boneAndInverse.push({bone: structuralNode, inverse: structuralNode.matrixWorld.clone().invert()});
690
694
  }
691
695
 
692
696
  // sort bones by path – need to be sorted in the same order as during mesh export
@@ -111,7 +111,7 @@ export class BehaviorExtension implements IUSDExporterExtension {
111
111
  if (actionModel instanceof GroupActionModel) {
112
112
  if (createMermaidGraphForDebugging) mermaidGraph += `subgraph Group_${actionModel.id}\n`;
113
113
  for (const action of actionModel.actions) {
114
- if (createMermaidGraphForDebugging) mermaidGraph += `${actionModel.id}[${actionModel.id}] -- ${actionModel.type} --> ${action.id}[${action.id}]\n`;
114
+ if (createMermaidGraphForDebugging) mermaidGraph += `${actionModel.id}[${actionModel.id}] -- ${actionModel.type},loops:${actionModel.loops} --> ${action.id}[${action.id}]\n`;
115
115
  collectAction(action);
116
116
  }
117
117
  if (createMermaidGraphForDebugging) mermaidGraph += `end\n`;