@needle-tools/engine 4.11.0 → 4.11.1-next.0bef517

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 (33) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +3 -1
  3. package/dist/{needle-engine.bundle-IPerDSpg.min.js → needle-engine.bundle-CETlDRXF.min.js} +100 -100
  4. package/dist/{needle-engine.bundle-DhRclTK5.umd.cjs → needle-engine.bundle-DgECSnSa.umd.cjs} +97 -97
  5. package/dist/{needle-engine.bundle-Dh4X0Qy5.js → needle-engine.bundle-GfmZcJ_E.js} +2646 -2575
  6. package/dist/needle-engine.js +2 -2
  7. package/dist/needle-engine.min.js +1 -1
  8. package/dist/needle-engine.umd.cjs +1 -1
  9. package/lib/engine/engine_physics.js +2 -1
  10. package/lib/engine/engine_physics.js.map +1 -1
  11. package/lib/engine-components/OrbitControls.js +2 -0
  12. package/lib/engine-components/OrbitControls.js.map +1 -1
  13. package/lib/engine-components/splines/SplineWalker.d.ts +43 -4
  14. package/lib/engine-components/splines/SplineWalker.js +88 -12
  15. package/lib/engine-components/splines/SplineWalker.js.map +1 -1
  16. package/lib/engine-components/web/Clickthrough.d.ts +2 -0
  17. package/lib/engine-components/web/Clickthrough.js +23 -1
  18. package/lib/engine-components/web/Clickthrough.js.map +1 -1
  19. package/lib/engine-components/web/ScrollFollow.d.ts +4 -9
  20. package/lib/engine-components/web/ScrollFollow.js +26 -30
  21. package/lib/engine-components/web/ScrollFollow.js.map +1 -1
  22. package/lib/engine-components/web/ViewBox.d.ts +16 -0
  23. package/lib/engine-components/web/ViewBox.js +35 -3
  24. package/lib/engine-components/web/ViewBox.js.map +1 -1
  25. package/package.json +2 -2
  26. package/plugins/types/userconfig.d.ts +7 -0
  27. package/plugins/vite/build-pipeline.js +14 -6
  28. package/src/engine/engine_physics.ts +3 -3
  29. package/src/engine-components/OrbitControls.ts +5 -2
  30. package/src/engine-components/splines/SplineWalker.ts +99 -14
  31. package/src/engine-components/web/Clickthrough.ts +29 -1
  32. package/src/engine-components/web/ScrollFollow.ts +31 -33
  33. package/src/engine-components/web/ViewBox.ts +35 -5
@@ -37,24 +37,47 @@ const disabledGizmoColor = new RGBAColor(.5, .5, .5, .5);
37
37
  * @component
38
38
  */
39
39
  let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
40
+ /**
41
+ * All active ViewBox instances. The last one in the array is the currently active one.
42
+ */
40
43
  static instances = [];
41
44
  /**
42
45
  * The reference field of view is used to calculate the box size. This should usually be the same as your camera's fov.
43
46
  * @default -1 (meaning it will use the camera fov on the first frame)
44
47
  */
45
48
  referenceFieldOfView = -1;
49
+ /**
50
+ * The mode determines if the viewbox should be applied once or continuously while it is the active viewbox.
51
+ * Options:
52
+ * - "once": The viewbox will be applied once when it becomes the active viewbox. This is useful if you want to fit the view once and then allow the user to zoom or pan freely.
53
+ * - "continuous": The viewbox will be applied continuously while it is the active viewbox. This is useful if you animate or scale the viewbox over time.
54
+ */
55
+ get mode() { return this._mode; }
56
+ set mode(v) {
57
+ if (v === this._mode)
58
+ return;
59
+ this._mode = v;
60
+ if (v === "once")
61
+ this._applyCount = 0;
62
+ if (debugParam || this.debug)
63
+ console.debug("[ViewBox] Set mode:", v);
64
+ }
65
+ _mode = "continuous";
46
66
  /**
47
67
  * Enable debug logs and rendering for this component instance
48
68
  */
49
69
  debug = false;
70
+ /** @internal */
50
71
  onEnable() {
51
72
  if (debugParam || this.debug || isDevEnvironment())
52
73
  console.debug("[ViewBox] Using camera fov:", this.referenceFieldOfView);
53
74
  // register instance
54
75
  ViewBox_1.instances.push(this);
76
+ this._applyCount = 0;
55
77
  this.removeUpdateCallback();
56
78
  this.context.pre_render_callbacks.push(this.internalUpdate);
57
79
  }
80
+ /** @internal */
58
81
  onDisable() {
59
82
  if (debugParam || this.debug)
60
83
  console.debug("[ViewBox] Disabled");
@@ -73,6 +96,7 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
73
96
  }
74
97
  static _tempProjectionMatrix = new Matrix4();
75
98
  static _tempProjectionMatrixInverse = new Matrix4();
99
+ _applyCount = 0;
76
100
  internalUpdate = () => {
77
101
  if (this.context.isInXR)
78
102
  return;
@@ -104,6 +128,10 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
104
128
  console.warn("[ViewBox] No valid referenceFieldOfView set, cannot adjust box size:", this.referenceFieldOfView);
105
129
  return;
106
130
  }
131
+ if (this._applyCount >= 1 && this.mode === "once") {
132
+ return;
133
+ }
134
+ this._applyCount++;
107
135
  const domWidth = this.context.domWidth;
108
136
  const domHeight = this.context.domHeight;
109
137
  let rectWidth = domWidth;
@@ -122,7 +150,7 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
122
150
  ViewBox_1._tempProjectionMatrix.copy(camera.projectionMatrix);
123
151
  ViewBox_1._tempProjectionMatrixInverse.copy(camera.projectionMatrixInverse);
124
152
  const view = camera.view;
125
- const zoom = camera.zoom;
153
+ const cameraZoom = camera.zoom;
126
154
  const aspect = camera.aspect;
127
155
  const fov = camera.fov;
128
156
  // Set values to default so we can calculate the box size correctly
@@ -173,6 +201,7 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
173
201
  const boxWidth = (projectedBox.maxX - projectedBox.minX);
174
202
  const boxHeight = (projectedBox.maxY - projectedBox.minY);
175
203
  const scale = this.fit(boxWidth * camera.aspect, boxHeight, width / diffWidth, height / diffHeight);
204
+ const zoom = scale / (height * .5);
176
205
  // console.log({ scale, width, height, boxWidth: boxWidth * camera.aspect, boxHeight, diffWidth, diffHeight, aspect: camera.aspect, distance })
177
206
  // this.context.focusRectSettings.zoom = 1.39;
178
207
  // if (!this.context.focusRect) this.context.setCameraFocusRect(this.context.domElement);
@@ -181,13 +210,13 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
181
210
  vec.project(camera);
182
211
  this.context.focusRectSettings.offsetX = vec.x;
183
212
  this.context.focusRectSettings.offsetY = vec.y;
184
- this.context.focusRectSettings.zoom = scale / (height * .5);
213
+ this.context.focusRectSettings.zoom = zoom;
185
214
  // if we don't have a focus rect yet, set it to the dom element
186
215
  if (!this.context.focusRect)
187
216
  this.context.setCameraFocusRect(this.context.domElement);
188
217
  // Reset values
189
218
  camera.view = view;
190
- camera.zoom = zoom;
219
+ camera.zoom = cameraZoom;
191
220
  camera.aspect = aspect;
192
221
  camera.fov = fov;
193
222
  camera.projectionMatrix.copy(ViewBox_1._tempProjectionMatrix);
@@ -259,6 +288,9 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
259
288
  __decorate([
260
289
  serializable()
261
290
  ], ViewBox.prototype, "referenceFieldOfView", void 0);
291
+ __decorate([
292
+ serializable()
293
+ ], ViewBox.prototype, "mode", null);
262
294
  __decorate([
263
295
  serializable()
264
296
  ], ViewBox.prototype, "debug", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"ViewBox.js","sourceRoot":"","sources":["../../../src/engine-components/web/ViewBox.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAU,OAAO,EAAE,iBAAiB,EAAuC,MAAM,OAAO,CAAC;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAC5C,MAAM,kBAAkB,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,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RY,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "4.11.0",
3
+ "version": "4.11.1-next.0bef517",
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": {
@@ -169,4 +169,4 @@
169
169
  "module": "lib/needle-engine.js",
170
170
  "typings": "lib/needle-engine.d.ts",
171
171
  "types": "lib/needle-engine.d.ts"
172
- }
172
+ }
@@ -75,6 +75,13 @@ export type userSettings = {
75
75
 
76
76
  /** If defined the access token will be used to run compression on Needle Cloud */
77
77
  accessToken?: string | undefined;
78
+
79
+ /**
80
+ * The max duration the build pipeline will wait for the website bundling process to finish. After bundling has finished the pipeline will start processing the exported glTF files.
81
+ * Default is 60000 (60 seconds)
82
+ * @default 60000
83
+ */
84
+ maxWaitDuration?: number; // in ms, default 60000 (60 seconds)
78
85
  }
79
86
 
80
87
  /** required for @serializable https://github.com/vitejs/vite/issues/13736 */
@@ -50,18 +50,21 @@ export function waitForBuildPipelineToFinish() {
50
50
  * and the final client build is triggered later (but the build pipeline is still running and waiting)
51
51
  */
52
52
  let maxOutputDirectoryCreatedWaitTime = 0;
53
+
54
+ let defaultWaitTime = 60_000; // 60 seconds
55
+
53
56
  /**
54
57
  * @param {boolean} debugLog
55
58
  */
56
59
  function increaseMaxWaitTime(debugLog) {
57
60
  maxOutputDirectoryCreatedWaitTime = Date.now();
58
- let maxWaitTime = 10_000;
61
+ let maxAdditionalWaitTime = defaultWaitTime;
59
62
  if (process.env.CI) {
60
- maxWaitTime += 50_000;
63
+ maxAdditionalWaitTime += 60_000;
61
64
  }
62
- maxOutputDirectoryCreatedWaitTime += maxWaitTime;
65
+ maxOutputDirectoryCreatedWaitTime += maxAdditionalWaitTime;
63
66
  if (debugLog) {
64
- log(`Increased max wait time by ${maxWaitTime / 1000}sec until ${new Date(maxOutputDirectoryCreatedWaitTime).toISOString()}`);
67
+ log(`Increased max wait time by ${maxAdditionalWaitTime / 1000}sec until ${new Date(maxOutputDirectoryCreatedWaitTime).toISOString()}`);
65
68
  }
66
69
  }
67
70
 
@@ -85,6 +88,10 @@ export const needleBuildPipeline = async (command, config, userSettings) => {
85
88
  const packageJsonPath = process.cwd() + "/package.json";
86
89
  await fixPackageJson(packageJsonPath);
87
90
 
91
+ if(userSettings.buildPipeline?.maxWaitDuration !== undefined && typeof userSettings.buildPipeline?.maxWaitDuration === "number" && userSettings.buildPipeline?.maxWaitDuration >= 0) {
92
+ log(`Set timeout to ${userSettings.buildPipeline?.maxWaitDuration}ms as defined in your config`);
93
+ defaultWaitTime = userSettings.buildPipeline?.maxWaitDuration;
94
+ }
88
95
 
89
96
  let shouldRun = false;
90
97
  const productionArgument = process.argv.indexOf("--production");
@@ -233,7 +240,7 @@ async function invokeBuildPipeline(opts, options = {}) {
233
240
  await delay(500);
234
241
  const outputDirectory = getOutputDirectory() + "/assets";
235
242
  const startWaitTime = Date.now();
236
- const maxEndTime = startWaitTime + 120_000;
243
+ const maxEndTime = startWaitTime + 300_000;
237
244
  /** wait until the output directory exists
238
245
  * @param {number} iteration
239
246
  * @returns {Promise<boolean>}
@@ -242,7 +249,8 @@ async function invokeBuildPipeline(opts, options = {}) {
242
249
  // we wait for the output directory
243
250
  if (!existsSync(outputDirectory)) {
244
251
  if (maxOutputDirectoryCreatedWaitTime != 0 && Date.now() > maxOutputDirectoryCreatedWaitTime) {
245
- log("Max wait time exceeded - aborting...");
252
+ const waitDuration = (Date.now() - startWaitTime) / 1000;
253
+ log(`Aborting after ${waitDuration} seconds... Your website bundling process did take longer than expected. Try increasing the timeout via the \`buildPipeline.timeoutDuration\` setting in your vite.config.js (default is 60 seconds).`);
246
254
  return Promise.resolve(false);
247
255
  }
248
256
  else if (Date.now() > maxEndTime) {
@@ -323,7 +323,7 @@ export class Physics {
323
323
 
324
324
  let shouldIntersectObject = true;
325
325
  const mesh = obj as Mesh | SkinnedMesh;
326
- const geo = mesh.geometry;
326
+ const geo = mesh.geometry as BufferGeometry | null | undefined;
327
327
 
328
328
  if (obj.raycastAllowed === false) {
329
329
  shouldIntersectObject = false;
@@ -356,7 +356,7 @@ export class Physics {
356
356
 
357
357
  let usePrecise = preference !== "bounds";
358
358
  if (options.precise === false) usePrecise = false;
359
- usePrecise ||= geo.getAttribute("position")?.array?.length < 64;
359
+ if (geo) usePrecise ||= geo.getAttribute("position")?.array?.length < 64;
360
360
  if (mesh instanceof GroundedSkybox) {
361
361
  usePrecise = false;
362
362
  }
@@ -379,7 +379,7 @@ export class Physics {
379
379
  }
380
380
 
381
381
  // Restore
382
- mesh.geometry = geo;
382
+ mesh.geometry = geo as any;
383
383
 
384
384
  // Debug
385
385
  if (debugPhysics && results.length != lastResultsCount) {
@@ -711,8 +711,10 @@ export class OrbitControls extends Behaviour implements ICameraController {
711
711
 
712
712
 
713
713
  if (this._controls) {
714
- if (this.debugLog)
715
- this._controls.domElement = this.context.renderer.domElement;
714
+ if (this.debugLog) this._controls.domElement = this.context.renderer.domElement;
715
+
716
+ const viewZoomFactor = 1 / (this.context.focusRectSettings?.zoom || 1);
717
+
716
718
  this._controls.enabled = !this._shouldDisable && this._camera === this.context.mainCameraComponent && !this.context.isInXR && !this._activePointerEvents.some(e => e.used);
717
719
  this._controls.keys = this.enableKeys ? defaultKeys : disabledKeys;
718
720
  this._controls.autoRotate = this.autoRotate;
@@ -723,6 +725,7 @@ export class OrbitControls extends Behaviour implements ICameraController {
723
725
  this._controls.enableDamping = this.enableDamping;
724
726
  this._controls.dampingFactor = this.dampingFactor;
725
727
  this._controls.enablePan = this.enablePan;
728
+ this._controls.panSpeed = viewZoomFactor;
726
729
  this._controls.enableRotate = this.enableRotate;
727
730
  this._controls.minAzimuthAngle = this.minAzimuthAngle;
728
731
  this._controls.maxAzimuthAngle = this.maxAzimuthAngle;
@@ -1,5 +1,5 @@
1
1
 
2
- import { Object3D } from "three"
2
+ import { Object3D, Vector3 } from "three"
3
3
 
4
4
  import { Mathf } from "../../engine/engine_math.js";
5
5
  import { serializeable } from "../../engine/engine_serialization_decorator.js";
@@ -7,7 +7,10 @@ import { Behaviour } from "../Component.js";
7
7
  import { SplineContainer } from "./Spline.js";
8
8
 
9
9
  /**
10
- * Moves an object along a spline. Use this with a SplineContainer component.
10
+ * Moves an object along a spline.
11
+ * Use this with a SplineContainer component.
12
+ *
13
+ * - Example http://samples.needle.tools/splines
11
14
  */
12
15
  export class SplineWalker extends Behaviour {
13
16
 
@@ -17,18 +20,35 @@ export class SplineWalker extends Behaviour {
17
20
  @serializeable(SplineContainer)
18
21
  spline: SplineContainer | null = null;
19
22
 
20
- /** The object to move along the spline. If object is undefined then the spline walker will use the gameObject the component has been added to
23
+ /**
24
+ * The object to move along the spline.
25
+ * If object is undefined then the spline walker will use it's own object (gameObject).
26
+ * If object is null the spline walker will not move any object.
21
27
  * @default undefined
22
28
  */
23
29
  @serializeable(Object3D)
24
30
  object?: Object3D | null = undefined;
25
31
 
26
- /** The object to look at while moving along the spline
32
+
33
+
34
+ /**
35
+ * If true the object will rotate to look in the direction of the spline while moving along it.
36
+ * @default true
37
+ */
38
+ @serializeable()
39
+ useLookAt = true;
40
+
41
+ /**
42
+ * The object to look at while moving along the spline.
43
+ * If null the object will look in the direction of the spline.
44
+ * This can be disabled by setting useLookAt to false.
27
45
  * @default null
28
46
  */
29
47
  @serializeable(Object3D)
30
48
  lookAt: Object3D | null = null;
31
-
49
+
50
+
51
+
32
52
  /**
33
53
  * When clamp is set to true, the position01 value will be clamped between 0 and 1 and the object will not loop the spline.
34
54
  * @default false
@@ -36,7 +56,10 @@ export class SplineWalker extends Behaviour {
36
56
  @serializeable()
37
57
  clamp: boolean = false;
38
58
 
39
- /** The current position on the spline. The value ranges from 0 (start of the spline curve) to 1 (end of the spline curve)
59
+ /**
60
+ * The current position on the spline. The value ranges from 0 (start of the spline curve) to 1 (end of the spline curve)
61
+ *
62
+ * When setting this value, the position will be updated in the next frame.
40
63
  * @default 0
41
64
  */
42
65
  // @type float
@@ -46,7 +69,7 @@ export class SplineWalker extends Behaviour {
46
69
  }
47
70
  set position01(v: number) {
48
71
  this._position01 = v;
49
- this.updateFromPosition();
72
+ this._needsUpdate = true;
50
73
  }
51
74
 
52
75
  /** Resets the position to 0 */
@@ -68,25 +91,60 @@ export class SplineWalker extends Behaviour {
68
91
  @serializeable()
69
92
  duration: number = 10;
70
93
 
94
+ /**
95
+ * The strength with which the object is pulled to the spline.
96
+ * This can be used to create a "rubber band" effect when the object is moved away from the spline by other forces.
97
+ * A value of 0 means no pull, a value of 1 means the object is always on the spline.
98
+ * @default 1
99
+ */
100
+ pullStrength: number = 1;
101
+
71
102
 
72
103
  // #region internal
73
104
 
74
105
  private _position01: number = 0;
106
+ private _needsUpdate = false;
75
107
 
76
108
  /** @internal */
77
109
  start() {
78
- if(this.object === undefined) this.object = this.gameObject;
110
+ if (this.object === undefined) this.object = this.gameObject;
79
111
  this.updateFromPosition();
80
112
  }
81
113
 
114
+ /** @internal */
115
+ onEnable(): void {
116
+ window.addEventListener("pointerdown", this.onUserInput, { passive: true });
117
+ window.addEventListener("wheel", this.onUserInput, { passive: true });
118
+ }
119
+ /** @internal */
120
+ onDisable(): void {
121
+ window.removeEventListener("pointerdown", this.onUserInput);
122
+ window.removeEventListener("wheel", this.onUserInput);
123
+ }
124
+ private onUserInput = () => {
125
+ if (this.object?.contains(this.context.mainCamera)) {
126
+ this._needsUpdate = false;
127
+ this._performedUpdates += 999;
128
+ }
129
+ }
130
+
131
+ /** @internal */
82
132
  update() {
83
133
  if (this.autoRun) {
134
+ this._needsUpdate = true;
84
135
  this._position01 += this.context.time.deltaTime / this.duration;
136
+ }
137
+
138
+ if (this._needsUpdate) {
139
+ this._needsUpdate = false;
85
140
  this.updateFromPosition();
86
141
  }
87
142
  }
88
143
 
89
-
144
+ /**
145
+ * Updates the position of the object based on the current position01 value.
146
+ * @internal
147
+ */
90
148
  private updateFromPosition() {
91
149
  if (!this.spline || !this.spline.curve) return;
92
150
  if (!this.object) return;
@@ -96,11 +154,38 @@ export class SplineWalker extends Behaviour {
96
154
 
97
155
  const t = this._position01 >= 1 ? 1 : this._position01 % 1;
98
156
  const pt = this.spline.getPointAt(t);
99
- this.object.worldPosition = pt;
100
- if (!this.lookAt) {
101
- const tan = this.spline.getTangentAt(t);
102
- this.object.lookAt(pt.add(tan));
157
+
158
+ if (this.pullStrength >= 1) {
159
+ this.object.worldPosition = pt;
160
+ }
161
+ else {
162
+ if (this._position01 !== this._lastPosition01) {
163
+ this._performedUpdates = 0;
164
+ }
165
+ this._requiredUpdates = Math.round(100 / this.pullStrength);
166
+ if (this._performedUpdates < this._requiredUpdates) {
167
+ const wp = this.object.worldPosition;
168
+ this._performedUpdates++;
169
+ const pull = Mathf.clamp01(this.pullStrength);
170
+ const newPosition = this.object.worldPosition = wp.lerp(pt, pull * (this.context.time.deltaTime / .3));
171
+ this._lastPositionVector.copy(newPosition);
172
+ this._needsUpdate = true;
173
+ }
103
174
  }
104
- else this.object.lookAt(this.lookAt.worldPosition);
175
+
176
+ if (this.useLookAt) {
177
+ if (!this.lookAt) {
178
+ const tan = this.spline.getTangentAt(t);
179
+ this.object.lookAt(pt.add(tan));
180
+ }
181
+ else this.object.lookAt(this.lookAt.worldPosition);
182
+ }
183
+
184
+ this._lastPosition01 = this._position01;
105
185
  }
186
+
187
+ private _lastPosition01 = 0;
188
+ private _requiredUpdates: number = 0;
189
+ private _performedUpdates: number = 0;
190
+ private _lastPositionVector = new Vector3();
106
191
  }
@@ -1,3 +1,5 @@
1
+ import { Vector2 } from "three";
2
+
1
3
  import { NEPointerEvent } from "../../engine/engine_input.js";
2
4
  import { onStart } from "../../engine/engine_lifecycle_api.js";
3
5
  import { addAttributeChangeCallback } from "../../engine/engine_utils.js";
@@ -45,12 +47,14 @@ export class ClickThrough extends Behaviour {
45
47
  this.context.input.addEventListener('pointermove', this.onPointerEvent, {
46
48
  queue: 100,
47
49
  });
50
+ window.addEventListener("touchstart", this.onTouchStart, { passive: true });
48
51
  window.addEventListener("touchend", this.onTouchEnd, { passive: true });
49
52
  this._previousPointerEvents = this.context.domElement.style.pointerEvents;
50
53
  }
51
54
  onDisable() {
52
55
  this.context.input.removeEventListener('pointerdown', this.onPointerEvent);
53
56
  this.context.input.removeEventListener('pointermove', this.onPointerEvent);
57
+ window.removeEventListener("touchstart", this.onTouchStart);
54
58
  window.removeEventListener("touchend", this.onTouchEnd);
55
59
  this.context.domElement.style.pointerEvents = this._previousPointerEvents;
56
60
  }
@@ -69,9 +73,33 @@ export class ClickThrough extends Behaviour {
69
73
  }
70
74
  };
71
75
 
76
+
77
+
78
+ // #region Touch hack
79
+
80
+ private _touchDidHitAnything = false;
81
+
82
+ private onTouchStart = (_evt: TouchEvent) => {
83
+
84
+ const touch = _evt.touches[0];
85
+ if (!touch) return;
86
+
87
+ const ndx = touch.clientX / window.innerWidth * 2 - 1;
88
+ const ndy = -(touch.clientY / window.innerHeight) * 2 + 1;
89
+ // console.log(ndx, ndy);
90
+ const hits = this.context.physics.raycast({
91
+ screenPoint: new Vector2(ndx, ndy),
92
+ })
93
+ if (hits.length > 0) {
94
+ this._touchDidHitAnything = true;
95
+ }
96
+ }
97
+
72
98
  private onTouchEnd = (_evt: TouchEvent) => {
99
+ const _didHit = this._touchDidHitAnything;
100
+ this._touchDidHitAnything = false;
73
101
  setTimeout(() => {
74
- this.context.domElement.style.pointerEvents = 'all';
102
+ if (_didHit) this.context.domElement.style.pointerEvents = 'all';
75
103
  }, 100);
76
104
  }
77
105
  }