@needle-tools/engine 3.2.15-alpha → 3.4.0-alpha

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 (151) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/needle-engine.js +44005 -36382
  3. package/dist/needle-engine.min.js +706 -513
  4. package/dist/needle-engine.umd.cjs +685 -492
  5. package/lib/engine/codegen/register_types.js +54 -4
  6. package/lib/engine/codegen/register_types.js.map +1 -1
  7. package/lib/engine/engine_addressables.d.ts +3 -3
  8. package/lib/engine/engine_addressables.js +30 -9
  9. package/lib/engine/engine_addressables.js.map +1 -1
  10. package/lib/engine/engine_element.js +1 -1
  11. package/lib/engine/engine_element.js.map +1 -1
  12. package/lib/engine/engine_gameobject.d.ts +2 -1
  13. package/lib/engine/engine_gameobject.js +19 -0
  14. package/lib/engine/engine_gameobject.js.map +1 -1
  15. package/lib/engine/engine_input.js +10 -0
  16. package/lib/engine/engine_input.js.map +1 -1
  17. package/lib/engine/engine_math.d.ts +4 -0
  18. package/lib/engine/engine_math.js +6 -0
  19. package/lib/engine/engine_math.js.map +1 -1
  20. package/lib/engine/engine_three_utils.js +2 -2
  21. package/lib/engine/engine_three_utils.js.map +1 -1
  22. package/lib/engine-components/Animation.js +4 -0
  23. package/lib/engine-components/Animation.js.map +1 -1
  24. package/lib/engine-components/AnimatorController.js +7 -2
  25. package/lib/engine-components/AnimatorController.js.map +1 -1
  26. package/lib/engine-components/OrbitControls.js +13 -4
  27. package/lib/engine-components/OrbitControls.js.map +1 -1
  28. package/lib/engine-components/TransformGizmo.d.ts +8 -4
  29. package/lib/engine-components/TransformGizmo.js +62 -63
  30. package/lib/engine-components/TransformGizmo.js.map +1 -1
  31. package/lib/engine-components/codegen/components.d.ts +27 -2
  32. package/lib/engine-components/codegen/components.js +27 -2
  33. package/lib/engine-components/codegen/components.js.map +1 -1
  34. package/lib/engine-components/export/usdz/Extension.d.ts +4 -4
  35. package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +86 -0
  36. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +830 -0
  37. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -0
  38. package/lib/engine-components/export/usdz/USDZExporter.d.ts +6 -3
  39. package/lib/engine-components/export/usdz/USDZExporter.js +34 -11
  40. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  41. package/lib/engine-components/export/usdz/extensions/Animation.d.ts +15 -15
  42. package/lib/engine-components/export/usdz/extensions/Animation.js +24 -29
  43. package/lib/engine-components/export/usdz/extensions/Animation.js.map +1 -1
  44. package/lib/engine-components/export/usdz/extensions/DocumentExtension.d.ts +5 -0
  45. package/lib/engine-components/export/usdz/extensions/DocumentExtension.js +7 -0
  46. package/lib/engine-components/export/usdz/extensions/DocumentExtension.js.map +1 -0
  47. package/lib/engine-components/export/usdz/extensions/USDZText.d.ts +47 -0
  48. package/lib/engine-components/export/usdz/extensions/USDZText.js +114 -0
  49. package/lib/engine-components/export/usdz/extensions/USDZText.js.map +1 -0
  50. package/lib/engine-components/export/usdz/extensions/behavior/Actions.d.ts +30 -0
  51. package/lib/engine-components/export/usdz/extensions/behavior/Actions.js +89 -0
  52. package/lib/engine-components/export/usdz/extensions/behavior/Actions.js.map +1 -0
  53. package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.d.ts +23 -0
  54. package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js +114 -0
  55. package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js.map +1 -0
  56. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +96 -0
  57. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +421 -0
  58. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -0
  59. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.d.ts +111 -0
  60. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js +409 -0
  61. package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js.map +1 -0
  62. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  63. package/lib/engine-components/ui/BaseUIComponent.d.ts +2 -0
  64. package/lib/engine-components/ui/BaseUIComponent.js +6 -0
  65. package/lib/engine-components/ui/BaseUIComponent.js.map +1 -1
  66. package/lib/engine-components/ui/Button.js +9 -5
  67. package/lib/engine-components/ui/Button.js.map +1 -1
  68. package/lib/engine-components/ui/Canvas.d.ts +23 -6
  69. package/lib/engine-components/ui/Canvas.js +167 -34
  70. package/lib/engine-components/ui/Canvas.js.map +1 -1
  71. package/lib/engine-components/ui/EventSystem.d.ts +6 -0
  72. package/lib/engine-components/ui/EventSystem.js +4 -4
  73. package/lib/engine-components/ui/EventSystem.js.map +1 -1
  74. package/lib/engine-components/ui/Graphic.d.ts +5 -2
  75. package/lib/engine-components/ui/Graphic.js +38 -7
  76. package/lib/engine-components/ui/Graphic.js.map +1 -1
  77. package/lib/engine-components/ui/Image.d.ts +1 -0
  78. package/lib/engine-components/ui/Image.js +14 -5
  79. package/lib/engine-components/ui/Image.js.map +1 -1
  80. package/lib/engine-components/ui/InputField.d.ts +1 -0
  81. package/lib/engine-components/ui/InputField.js +8 -0
  82. package/lib/engine-components/ui/InputField.js.map +1 -1
  83. package/lib/engine-components/ui/Interfaces.d.ts +19 -0
  84. package/lib/engine-components/ui/Interfaces.js +11 -0
  85. package/lib/engine-components/ui/Interfaces.js.map +1 -1
  86. package/lib/engine-components/ui/Layout.d.ts +65 -3
  87. package/lib/engine-components/ui/Layout.js +304 -3
  88. package/lib/engine-components/ui/Layout.js.map +1 -1
  89. package/lib/engine-components/ui/Outline.d.ts +7 -0
  90. package/lib/engine-components/ui/Outline.js +21 -0
  91. package/lib/engine-components/ui/Outline.js.map +1 -0
  92. package/lib/engine-components/ui/RectTransform.d.ts +32 -13
  93. package/lib/engine-components/ui/RectTransform.js +216 -56
  94. package/lib/engine-components/ui/RectTransform.js.map +1 -1
  95. package/lib/engine-components/ui/Text.d.ts +13 -10
  96. package/lib/engine-components/ui/Text.js +177 -246
  97. package/lib/engine-components/ui/Text.js.map +1 -1
  98. package/lib/engine-components/utils/LookAt.d.ts +13 -0
  99. package/lib/engine-components/utils/LookAt.js +66 -0
  100. package/lib/engine-components/utils/LookAt.js.map +1 -0
  101. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +12 -3
  102. package/lib/engine-components/webxr/WebXRImageTracking.js +156 -24
  103. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  104. package/lib/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +2 -2
  106. package/plugins/vite/reload.js +13 -2
  107. package/src/engine/codegen/register_types.js +56 -6
  108. package/src/engine/engine_addressables.ts +28 -10
  109. package/src/engine/engine_element.ts +1 -1
  110. package/src/engine/engine_gameobject.ts +19 -1
  111. package/src/engine/engine_input.ts +11 -0
  112. package/src/engine/engine_math.ts +10 -0
  113. package/src/engine/engine_three_utils.ts +2 -2
  114. package/src/engine-components/Animation.ts +4 -0
  115. package/src/engine-components/AnimatorController.ts +7 -1
  116. package/src/engine-components/OrbitControls.ts +14 -6
  117. package/src/engine-components/TransformGizmo.ts +64 -70
  118. package/src/engine-components/codegen/components.ts +27 -2
  119. package/src/engine-components/export/usdz/Extension.ts +4 -5
  120. package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +1280 -0
  121. package/src/engine-components/export/usdz/USDZExporter.ts +39 -17
  122. package/src/engine-components/export/usdz/extensions/Animation.ts +37 -45
  123. package/src/engine-components/export/usdz/extensions/DocumentExtension.ts +10 -0
  124. package/src/engine-components/export/usdz/extensions/USDZText.ts +142 -0
  125. package/src/engine-components/export/usdz/extensions/behavior/Actions.ts +99 -0
  126. package/src/engine-components/export/usdz/extensions/behavior/Behaviour.ts +181 -0
  127. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +503 -0
  128. package/src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts +459 -0
  129. package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
  130. package/src/engine-components/ui/BaseUIComponent.ts +7 -1
  131. package/src/engine-components/ui/Button.ts +14 -9
  132. package/src/engine-components/ui/Canvas.ts +178 -39
  133. package/src/engine-components/ui/EventSystem.ts +16 -9
  134. package/src/engine-components/ui/Graphic.ts +46 -8
  135. package/src/engine-components/ui/Image.ts +13 -4
  136. package/src/engine-components/ui/InputField.ts +9 -1
  137. package/src/engine-components/ui/Interfaces.ts +39 -3
  138. package/src/engine-components/ui/Layout.ts +303 -4
  139. package/src/engine-components/ui/Outline.ts +13 -0
  140. package/src/engine-components/ui/RectTransform.ts +236 -68
  141. package/src/engine-components/ui/Text.ts +284 -265
  142. package/src/engine-components/utils/LookAt.ts +74 -0
  143. package/src/engine-components/webxr/WebXRImageTracking.ts +179 -31
  144. package/lib/engine-components/export/usdz/types.d.ts +0 -34
  145. package/lib/engine-components/export/usdz/types.js +0 -2
  146. package/lib/engine-components/export/usdz/types.js.map +0 -1
  147. package/lib/engine-components/ui/Keyboard.d.ts +0 -31
  148. package/lib/engine-components/ui/Keyboard.js +0 -178
  149. package/lib/engine-components/ui/Keyboard.js.map +0 -1
  150. package/src/engine-components/export/usdz/types.ts +0 -39
  151. package/src/engine-components/ui/Keyboard.ts +0 -204
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "3.2.15-alpha",
3
+ "version": "3.4.0-alpha",
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.umd.cjs",
6
6
  "type": "module",
@@ -62,7 +62,7 @@
62
62
  "simplex-noise": "^4.0.1",
63
63
  "stats.js": "^0.17.0",
64
64
  "three": "npm:@needle-tools/three@^0.146.8",
65
- "three-mesh-ui": "^6.4.5",
65
+ "three-mesh-ui": "npm:@needle-tools/three-mesh-ui@^7.1.4",
66
66
  "three.quarks": "^0.7.3",
67
67
  "uuid": "^9.0.0",
68
68
  "websocket-ts": "^1.1.1"
@@ -9,6 +9,7 @@ const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = path.dirname(__filename);
10
10
 
11
11
  const filesUsingHotReload = new Set();
12
+ let assetsDirectory = "";
12
13
 
13
14
  export const needleReload = (command, config, userSettings) => {
14
15
  if (command === "build") return;
@@ -23,8 +24,9 @@ export const needleReload = (command, config, userSettings) => {
23
24
  if (res) config = res;
24
25
  }
25
26
 
26
-
27
27
  const projectConfig = tryLoadProjectConfig();
28
+ assetsDirectory = path.resolve(projectConfig?.assetsDirectory || "assets");
29
+
28
30
  const buildDirectory = projectConfig?.buildDirectory?.length ? process.cwd().replaceAll("\\", "/") + "/" + projectConfig?.buildDirectory : "";
29
31
  if (buildDirectory?.length) {
30
32
  setTimeout(() => console.log("Build directory: ", buildDirectory), 100);
@@ -153,7 +155,16 @@ async function handleReload({ file, server, modules, read, buildDirectory }) {
153
155
  }
154
156
  }
155
157
 
156
- if (file.endsWith(".vue") || file.endsWith(".ts") || file.endsWith(".js") || file.endsWith(".jsx") || file.endsWith(".tsx"))
158
+ // these are known file types we export from integrations
159
+ const knownExportFileTypes = [ ".glb", ".gltf", ".bin", "exr", ".ktx2", ".mp3", ".ogg", ".mp4", ".webm" ];
160
+ if (!knownExportFileTypes.some((type) => file.endsWith(type)))
161
+ return;
162
+
163
+ // we only care about exports into "assets"
164
+ if (!path.resolve(file).startsWith(assetsDirectory))
165
+ return;
166
+
167
+ if (file.endsWith(".svelte") || file.endsWith(".vue") || file.endsWith(".ts") || file.endsWith(".js") || file.endsWith(".jsx") || file.endsWith(".tsx"))
157
168
  return;
158
169
 
159
170
  if (file.endsWith(lockFileName)) return;
@@ -1,7 +1,10 @@
1
1
  import { TypeStore } from "./../engine_typestore"
2
-
2
+
3
3
  // Import types
4
4
  import { __Ignore } from "../../engine-components/codegen/components";
5
+ import { ActionBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
6
+ import { ActionCollection } from "../../engine-components/export/usdz/extensions/behavior/Actions";
7
+ import { ActionModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
5
8
  import { AlignmentConstraint } from "../../engine-components/AlignmentConstraint";
6
9
  import { Animation } from "../../engine-components/Animation";
7
10
  import { AnimationCurve } from "../../engine-components/AnimationCurve";
@@ -26,6 +29,8 @@ import { AvatarModel } from "../../engine-components/AvatarLoader";
26
29
  import { AxesHelper } from "../../engine-components/AxesHelper";
27
30
  import { BaseUIComponent } from "../../engine-components/ui/BaseUIComponent";
28
31
  import { BasicIKConstraint } from "../../engine-components/BasicIKConstraint";
32
+ import { BehaviorExtension } from "../../engine-components/export/usdz/extensions/behavior/Behaviour";
33
+ import { BehaviorModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
29
34
  import { Behaviour } from "../../engine-components/Component";
30
35
  import { Bloom } from "../../engine-components/postprocessing/Effects/Bloom";
31
36
  import { BoxCollider } from "../../engine-components/Collider";
@@ -37,6 +42,8 @@ import { Camera } from "../../engine-components/Camera";
37
42
  import { Canvas } from "../../engine-components/ui/Canvas";
38
43
  import { CanvasGroup } from "../../engine-components/ui/CanvasGroup";
39
44
  import { CapsuleCollider } from "../../engine-components/Collider";
45
+ import { ChangeMaterialOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
46
+ import { ChangeTransformOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
40
47
  import { CharacterController } from "../../engine-components/CharacterController";
41
48
  import { CharacterControllerInput } from "../../engine-components/CharacterController";
42
49
  import { ChromaticAberration } from "../../engine-components/postprocessing/Effects/ChromaticAberration";
@@ -50,10 +57,12 @@ import { Deletable } from "../../engine-components/DeleteBox";
50
57
  import { DeleteBox } from "../../engine-components/DeleteBox";
51
58
  import { DepthOfField } from "../../engine-components/postprocessing/Effects/DepthOfField";
52
59
  import { DeviceFlag } from "../../engine-components/DeviceFlag";
60
+ import { DocumentExtension } from "../../engine-components/export/usdz/extensions/DocumentExtension";
53
61
  import { DragControls } from "../../engine-components/DragControls";
54
62
  import { DropListener } from "../../engine-components/DropListener";
55
63
  import { Duplicatable } from "../../engine-components/Duplicatable";
56
64
  import { EmissionModule } from "../../engine-components/ParticleSystemModules";
65
+ import { EmphasizeOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
57
66
  import { EventList } from "../../engine-components/EventList";
58
67
  import { EventListEvent } from "../../engine-components/EventList";
59
68
  import { EventSystem } from "../../engine-components/ui/EventSystem";
@@ -70,19 +79,20 @@ import { GraphicRaycaster } from "../../engine-components/ui/Raycaster";
70
79
  import { GridHelper } from "../../engine-components/GridHelper";
71
80
  import { GridLayoutGroup } from "../../engine-components/ui/Layout";
72
81
  import { GroundProjectedEnv } from "../../engine-components/GroundProjection";
82
+ import { GroupActionModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
83
+ import { HideOnStart } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
73
84
  import { HingeJoint } from "../../engine-components/Joints";
74
85
  import { HorizontalLayoutGroup } from "../../engine-components/ui/Layout";
75
86
  import { Image } from "../../engine-components/ui/Image";
76
87
  import { InheritVelocityModule } from "../../engine-components/ParticleSystemModules";
77
88
  import { InputField } from "../../engine-components/ui/InputField";
78
89
  import { Interactable } from "../../engine-components/Interactable";
79
- import { Keyboard } from "../../engine-components/ui/Keyboard";
80
- import { LayoutGroup } from "../../engine-components/ui/Layout";
81
90
  import { Light } from "../../engine-components/Light";
82
91
  import { LimitVelocityOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
83
92
  import { LODGroup } from "../../engine-components/LODGroup";
84
93
  import { LODModel } from "../../engine-components/LODGroup";
85
94
  import { LogStats } from "../../engine-components/debug/LogStats";
95
+ import { LookAt } from "../../engine-components/utils/LookAt";
86
96
  import { LookAtConstraint } from "../../engine-components/LookAtConstraint";
87
97
  import { MainModule } from "../../engine-components/ParticleSystemModules";
88
98
  import { MaskableGraphic } from "../../engine-components/ui/Graphic";
@@ -97,17 +107,22 @@ import { ObjectRaycaster } from "../../engine-components/ui/Raycaster";
97
107
  import { OffsetConstraint } from "../../engine-components/OffsetConstraint";
98
108
  import { OpenURL } from "../../engine-components/utils/OpenURL";
99
109
  import { OrbitControls } from "../../engine-components/OrbitControls";
110
+ import { Outline } from "../../engine-components/ui/Outline";
111
+ import { Padding } from "../../engine-components/ui/Layout";
100
112
  import { ParticleBurst } from "../../engine-components/ParticleSystemModules";
101
113
  import { ParticleSubEmitter } from "../../engine-components/ParticleSystemSubEmitter";
102
114
  import { ParticleSystem } from "../../engine-components/ParticleSystem";
103
115
  import { ParticleSystemRenderer } from "../../engine-components/ParticleSystem";
104
116
  import { PixelationEffect } from "../../engine-components/postprocessing/Effects/Pixelation";
105
117
  import { PlayableDirector } from "../../engine-components/timeline/PlayableDirector";
118
+ import { PlayAnimationOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
106
119
  import { PlayerColor } from "../../engine-components/PlayerColor";
107
120
  import { PlayerState } from "../../engine-components-experimental/networking/PlayerSync";
108
121
  import { PlayerSync } from "../../engine-components-experimental/networking/PlayerSync";
109
122
  import { PointerEventData } from "../../engine-components/ui/PointerEvents";
110
123
  import { PostProcessingHandler } from "../../engine-components/postprocessing/PostProcessingHandler";
124
+ import { PreliminaryAction } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
125
+ import { PreliminaryTrigger } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
111
126
  import { PresentationMode } from "../../engine-components-experimental/Presentation";
112
127
  import { QuickLookOverlay } from "../../engine-components/export/usdz/USDZExporter";
113
128
  import { RawImage } from "../../engine-components/ui/Image";
@@ -126,6 +141,7 @@ import { RotationOverLifetimeModule } from "../../engine-components/ParticleSyst
126
141
  import { SceneSwitcher } from "../../engine-components/SceneSwitcher";
127
142
  import { ScreenCapture } from "../../engine-components/ScreenCapture";
128
143
  import { ScreenSpaceAmbientOcclusion } from "../../engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion";
144
+ import { SetActiveOnClick } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
129
145
  import { ShadowCatcher } from "../../engine-components/ShadowCatcher";
130
146
  import { ShapeModule } from "../../engine-components/ParticleSystemModules";
131
147
  import { SignalAsset } from "../../engine-components/timeline/SignalAsset";
@@ -150,24 +166,33 @@ import { SubEmitterSystem } from "../../engine-components/ParticleSystem";
150
166
  import { SyncedCamera } from "../../engine-components/SyncedCamera";
151
167
  import { SyncedRoom } from "../../engine-components/SyncedRoom";
152
168
  import { SyncedTransform } from "../../engine-components/SyncedTransform";
169
+ import { TapGestureTrigger } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
153
170
  import { TeleportTarget } from "../../engine-components/webxr/WebXRController";
154
171
  import { TestRunner } from "../../engine-components/TestRunner";
155
172
  import { TestSimulateUserData } from "../../engine-components/TestRunner";
156
173
  import { Text } from "../../engine-components/ui/Text";
174
+ import { TextBuilder } from "../../engine-components/export/usdz/extensions/USDZText";
175
+ import { TextExtension } from "../../engine-components/export/usdz/extensions/USDZText";
157
176
  import { TextureSheetAnimationModule } from "../../engine-components/ParticleSystemModules";
158
177
  import { TiltShiftEffect } from "../../engine-components/postprocessing/Effects/TiltShiftEffect";
159
178
  import { ToneMapping } from "../../engine-components/postprocessing/Effects/Tonemapping";
160
179
  import { TrailModule } from "../../engine-components/ParticleSystemModules";
161
180
  import { TransformData } from "../../engine-components/export/usdz/extensions/Animation";
162
181
  import { TransformGizmo } from "../../engine-components/TransformGizmo";
182
+ import { TriggerBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
183
+ import { TriggerModel } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
163
184
  import { UIRaycastUtils } from "../../engine-components/ui/RaycastUtils";
164
185
  import { UIRootComponent } from "../../engine-components/ui/BaseUIComponent";
165
186
  import { UsageMarker } from "../../engine-components/Interactable";
187
+ import { USDZBehaviours } from "../../engine-components/export/usdz/extensions/behavior/Behaviour";
166
188
  import { USDZExporter } from "../../engine-components/export/usdz/USDZExporter";
189
+ import { USDZText } from "../../engine-components/export/usdz/extensions/USDZText";
190
+ import { VariantAction } from "../../engine-components/export/usdz/extensions/behavior/Actions";
167
191
  import { VelocityOverLifetimeModule } from "../../engine-components/ParticleSystemModules";
168
192
  import { VerticalLayoutGroup } from "../../engine-components/ui/Layout";
169
193
  import { VideoPlayer } from "../../engine-components/VideoPlayer";
170
194
  import { Vignette } from "../../engine-components/postprocessing/Effects/Vignette";
195
+ import { VisibilityAction } from "../../engine-components/export/usdz/extensions/behavior/BehaviourComponents";
171
196
  import { Voip } from "../../engine-components/Voip";
172
197
  import { Volume } from "../../engine-components/postprocessing/Volume";
173
198
  import { VolumeParameter } from "../../engine-components/postprocessing/VolumeParameter";
@@ -189,9 +214,12 @@ import { XRGrabModel } from "../../engine-components/webxr/WebXRGrabRendering";
189
214
  import { XRGrabRendering } from "../../engine-components/webxr/WebXRGrabRendering";
190
215
  import { XRRig } from "../../engine-components/webxr/WebXRRig";
191
216
  import { XRState } from "../../engine-components/XRFlag";
192
-
217
+
193
218
  // Register types
194
219
  TypeStore.add("__Ignore", __Ignore);
220
+ TypeStore.add("ActionBuilder", ActionBuilder);
221
+ TypeStore.add("ActionCollection", ActionCollection);
222
+ TypeStore.add("ActionModel", ActionModel);
195
223
  TypeStore.add("AlignmentConstraint", AlignmentConstraint);
196
224
  TypeStore.add("Animation", Animation);
197
225
  TypeStore.add("AnimationCurve", AnimationCurve);
@@ -216,6 +244,8 @@ TypeStore.add("AvatarModel", AvatarModel);
216
244
  TypeStore.add("AxesHelper", AxesHelper);
217
245
  TypeStore.add("BaseUIComponent", BaseUIComponent);
218
246
  TypeStore.add("BasicIKConstraint", BasicIKConstraint);
247
+ TypeStore.add("BehaviorExtension", BehaviorExtension);
248
+ TypeStore.add("BehaviorModel", BehaviorModel);
219
249
  TypeStore.add("Behaviour", Behaviour);
220
250
  TypeStore.add("Bloom", Bloom);
221
251
  TypeStore.add("BoxCollider", BoxCollider);
@@ -227,6 +257,8 @@ TypeStore.add("Camera", Camera);
227
257
  TypeStore.add("Canvas", Canvas);
228
258
  TypeStore.add("CanvasGroup", CanvasGroup);
229
259
  TypeStore.add("CapsuleCollider", CapsuleCollider);
260
+ TypeStore.add("ChangeMaterialOnClick", ChangeMaterialOnClick);
261
+ TypeStore.add("ChangeTransformOnClick", ChangeTransformOnClick);
230
262
  TypeStore.add("CharacterController", CharacterController);
231
263
  TypeStore.add("CharacterControllerInput", CharacterControllerInput);
232
264
  TypeStore.add("ChromaticAberration", ChromaticAberration);
@@ -240,10 +272,12 @@ TypeStore.add("Deletable", Deletable);
240
272
  TypeStore.add("DeleteBox", DeleteBox);
241
273
  TypeStore.add("DepthOfField", DepthOfField);
242
274
  TypeStore.add("DeviceFlag", DeviceFlag);
275
+ TypeStore.add("DocumentExtension", DocumentExtension);
243
276
  TypeStore.add("DragControls", DragControls);
244
277
  TypeStore.add("DropListener", DropListener);
245
278
  TypeStore.add("Duplicatable", Duplicatable);
246
279
  TypeStore.add("EmissionModule", EmissionModule);
280
+ TypeStore.add("EmphasizeOnClick", EmphasizeOnClick);
247
281
  TypeStore.add("EventList", EventList);
248
282
  TypeStore.add("EventListEvent", EventListEvent);
249
283
  TypeStore.add("EventSystem", EventSystem);
@@ -260,19 +294,20 @@ TypeStore.add("GraphicRaycaster", GraphicRaycaster);
260
294
  TypeStore.add("GridHelper", GridHelper);
261
295
  TypeStore.add("GridLayoutGroup", GridLayoutGroup);
262
296
  TypeStore.add("GroundProjectedEnv", GroundProjectedEnv);
297
+ TypeStore.add("GroupActionModel", GroupActionModel);
298
+ TypeStore.add("HideOnStart", HideOnStart);
263
299
  TypeStore.add("HingeJoint", HingeJoint);
264
300
  TypeStore.add("HorizontalLayoutGroup", HorizontalLayoutGroup);
265
301
  TypeStore.add("Image", Image);
266
302
  TypeStore.add("InheritVelocityModule", InheritVelocityModule);
267
303
  TypeStore.add("InputField", InputField);
268
304
  TypeStore.add("Interactable", Interactable);
269
- TypeStore.add("Keyboard", Keyboard);
270
- TypeStore.add("LayoutGroup", LayoutGroup);
271
305
  TypeStore.add("Light", Light);
272
306
  TypeStore.add("LimitVelocityOverLifetimeModule", LimitVelocityOverLifetimeModule);
273
307
  TypeStore.add("LODGroup", LODGroup);
274
308
  TypeStore.add("LODModel", LODModel);
275
309
  TypeStore.add("LogStats", LogStats);
310
+ TypeStore.add("LookAt", LookAt);
276
311
  TypeStore.add("LookAtConstraint", LookAtConstraint);
277
312
  TypeStore.add("MainModule", MainModule);
278
313
  TypeStore.add("MaskableGraphic", MaskableGraphic);
@@ -287,17 +322,22 @@ TypeStore.add("ObjectRaycaster", ObjectRaycaster);
287
322
  TypeStore.add("OffsetConstraint", OffsetConstraint);
288
323
  TypeStore.add("OpenURL", OpenURL);
289
324
  TypeStore.add("OrbitControls", OrbitControls);
325
+ TypeStore.add("Outline", Outline);
326
+ TypeStore.add("Padding", Padding);
290
327
  TypeStore.add("ParticleBurst", ParticleBurst);
291
328
  TypeStore.add("ParticleSubEmitter", ParticleSubEmitter);
292
329
  TypeStore.add("ParticleSystem", ParticleSystem);
293
330
  TypeStore.add("ParticleSystemRenderer", ParticleSystemRenderer);
294
331
  TypeStore.add("PixelationEffect", PixelationEffect);
295
332
  TypeStore.add("PlayableDirector", PlayableDirector);
333
+ TypeStore.add("PlayAnimationOnClick", PlayAnimationOnClick);
296
334
  TypeStore.add("PlayerColor", PlayerColor);
297
335
  TypeStore.add("PlayerState", PlayerState);
298
336
  TypeStore.add("PlayerSync", PlayerSync);
299
337
  TypeStore.add("PointerEventData", PointerEventData);
300
338
  TypeStore.add("PostProcessingHandler", PostProcessingHandler);
339
+ TypeStore.add("PreliminaryAction", PreliminaryAction);
340
+ TypeStore.add("PreliminaryTrigger", PreliminaryTrigger);
301
341
  TypeStore.add("PresentationMode", PresentationMode);
302
342
  TypeStore.add("QuickLookOverlay", QuickLookOverlay);
303
343
  TypeStore.add("RawImage", RawImage);
@@ -316,6 +356,7 @@ TypeStore.add("RotationOverLifetimeModule", RotationOverLifetimeModule);
316
356
  TypeStore.add("SceneSwitcher", SceneSwitcher);
317
357
  TypeStore.add("ScreenCapture", ScreenCapture);
318
358
  TypeStore.add("ScreenSpaceAmbientOcclusion", ScreenSpaceAmbientOcclusion);
359
+ TypeStore.add("SetActiveOnClick", SetActiveOnClick);
319
360
  TypeStore.add("ShadowCatcher", ShadowCatcher);
320
361
  TypeStore.add("ShapeModule", ShapeModule);
321
362
  TypeStore.add("SignalAsset", SignalAsset);
@@ -340,24 +381,33 @@ TypeStore.add("SubEmitterSystem", SubEmitterSystem);
340
381
  TypeStore.add("SyncedCamera", SyncedCamera);
341
382
  TypeStore.add("SyncedRoom", SyncedRoom);
342
383
  TypeStore.add("SyncedTransform", SyncedTransform);
384
+ TypeStore.add("TapGestureTrigger", TapGestureTrigger);
343
385
  TypeStore.add("TeleportTarget", TeleportTarget);
344
386
  TypeStore.add("TestRunner", TestRunner);
345
387
  TypeStore.add("TestSimulateUserData", TestSimulateUserData);
346
388
  TypeStore.add("Text", Text);
389
+ TypeStore.add("TextBuilder", TextBuilder);
390
+ TypeStore.add("TextExtension", TextExtension);
347
391
  TypeStore.add("TextureSheetAnimationModule", TextureSheetAnimationModule);
348
392
  TypeStore.add("TiltShiftEffect", TiltShiftEffect);
349
393
  TypeStore.add("ToneMapping", ToneMapping);
350
394
  TypeStore.add("TrailModule", TrailModule);
351
395
  TypeStore.add("TransformData", TransformData);
352
396
  TypeStore.add("TransformGizmo", TransformGizmo);
397
+ TypeStore.add("TriggerBuilder", TriggerBuilder);
398
+ TypeStore.add("TriggerModel", TriggerModel);
353
399
  TypeStore.add("UIRaycastUtils", UIRaycastUtils);
354
400
  TypeStore.add("UIRootComponent", UIRootComponent);
355
401
  TypeStore.add("UsageMarker", UsageMarker);
402
+ TypeStore.add("USDZBehaviours", USDZBehaviours);
356
403
  TypeStore.add("USDZExporter", USDZExporter);
404
+ TypeStore.add("USDZText", USDZText);
405
+ TypeStore.add("VariantAction", VariantAction);
357
406
  TypeStore.add("VelocityOverLifetimeModule", VelocityOverLifetimeModule);
358
407
  TypeStore.add("VerticalLayoutGroup", VerticalLayoutGroup);
359
408
  TypeStore.add("VideoPlayer", VideoPlayer);
360
409
  TypeStore.add("Vignette", Vignette);
410
+ TypeStore.add("VisibilityAction", VisibilityAction);
361
411
  TypeStore.add("Voip", Voip);
362
412
  TypeStore.add("Volume", Volume);
363
413
  TypeStore.add("VolumeParameter", VolumeParameter);
@@ -27,8 +27,8 @@ export class Addressables {
27
27
 
28
28
  private _assetReferences: { [key: string]: AssetReference } = {};
29
29
 
30
- findAssetReference(uri: string): AssetReference | null {
31
- return this._assetReferences[uri] || null;
30
+ findAssetReference(key: string): AssetReference | null {
31
+ return this._assetReferences[key] || null;
32
32
  }
33
33
 
34
34
  registerAssetReference(ref: AssetReference): AssetReference {
@@ -48,9 +48,9 @@ export type ProgressCallback = (asset: AssetReference, prog: ProgressEvent) => v
48
48
 
49
49
  export class AssetReference {
50
50
 
51
- static getOrCreate(sourceId: SourceIdentifier, uri: string, context: Context): AssetReference {
52
- const fullPath = resolveUrl(sourceId, uri);
53
- if (debug) console.log("GetOrCreate Addressable from", sourceId, uri, "FinalPath=", fullPath);
51
+ static getOrCreate(sourceId: SourceIdentifier, url: string, context: Context): AssetReference {
52
+ const fullPath = resolveUrl(sourceId, url);
53
+ if (debug) console.log("GetOrCreate Addressable from", sourceId, url, "FinalPath=", fullPath);
54
54
  const addressables = context.addressables;
55
55
  const existing = addressables.findAssetReference(fullPath);
56
56
  if (existing) return existing;
@@ -89,19 +89,19 @@ export class AssetReference {
89
89
  private _isLoadingRawBinary: boolean = false;
90
90
  private _rawBinary?: ArrayBuffer | null;
91
91
 
92
- constructor(uri: string, hash?: string) {
92
+ constructor(uri: string, hash?: string, asset: any = null) {
93
93
  this._url = uri;
94
94
  this._hash = hash;
95
95
  if (uri.includes("?v="))
96
96
  this._hashedUri = uri;
97
97
  else
98
98
  this._hashedUri = hash ? uri + "?v=" + hash : uri;
99
-
99
+ if (asset !== null) this.asset = asset;
100
100
  registerPrefabProvider(this._url, this.onResolvePrefab.bind(this));
101
101
  }
102
102
 
103
- private async onResolvePrefab(uri: string): Promise<IGameObject | null> {
104
- if (uri === this.uri) {
103
+ private async onResolvePrefab(url: string): Promise<IGameObject | null> {
104
+ if (url === this.uri) {
105
105
  if (this.mustLoad) await this.loadAssetAsync();
106
106
  if (this.asset) {
107
107
  return this.asset;
@@ -320,12 +320,30 @@ class AddressableSerializer extends TypeSerializer {
320
320
  return null;
321
321
  }
322
322
  if (!context.gltfId) {
323
- console.error("Missing spurce id");
323
+ console.error("Missing source id");
324
324
  return null;
325
325
  }
326
326
  const ref = AssetReference.getOrCreate(context.gltfId, data, context.context);
327
327
  return ref;
328
328
  }
329
+ else if (data instanceof Object3D) {
330
+ if (!context.context) {
331
+ console.error("Missing context");
332
+ return null;
333
+ }
334
+ if (!context.gltfId) {
335
+ console.error("Missing source id");
336
+ return null;
337
+ }
338
+ const obj = data;
339
+ const ctx = context.context;
340
+ const guid = obj["guid"] ?? obj.uuid;
341
+ const existing = ctx.addressables.findAssetReference(guid);
342
+ if (existing) return existing;
343
+ const ref = new AssetReference(guid, undefined, obj);
344
+ ctx.addressables.registerAssetReference(ref);
345
+ return ref;
346
+ }
329
347
  return null;
330
348
  }
331
349
 
@@ -448,5 +448,5 @@ function getNameFromUrl(str: string) {
448
448
  let index = name.indexOf("?")
449
449
  if (index > 0)
450
450
  name = name.substring(0, index);
451
- return name;
451
+ return decodeURIComponent(name);
452
452
  }
@@ -3,7 +3,7 @@ import { processNewScripts } from "./engine_mainloop_utils";
3
3
  import { InstantiateIdProvider } from "./engine_networking_instantiate";
4
4
  import { Context, registerComponent } from "./engine_setup";
5
5
  import { logHierarchy, setWorldPosition, setWorldQuaternion } from "./engine_three_utils";
6
- import { GuidsMap, IComponent as Component, IComponent, IGameObject as GameObject, UIDProvider } from "./engine_types";
6
+ import { GuidsMap, IComponent as Component, IComponent, IGameObject as GameObject, UIDProvider, Constructor } from "./engine_types";
7
7
  import { getParam, tryFindObject } from "./engine_utils";
8
8
  import { apply } from "../engine-components/js-extensions/Object3D";
9
9
  import { $isUsingInstancing, InstancingUtil } from "./engine_instancing";
@@ -163,6 +163,24 @@ export function foreachComponent(instance: Object3D, cb: ForEachComponentCallbac
163
163
  return internalForEachComponent(instance, cb, recursive);
164
164
  }
165
165
 
166
+ export function* foreachComponentEnumerator<T extends IComponent>(instance: Object3D, type?: Constructor<T>, includeChildren: boolean = false, maxLevel: number = 999, _currentLevel: number = 0): Generator<T> {
167
+ if (!instance?.userData.components) return;
168
+ if (_currentLevel > maxLevel) return;
169
+ for (const comp of instance.userData.components) {
170
+ if (type && comp?.isComponent === true && comp instanceof type) {
171
+ yield comp;
172
+ }
173
+ else {
174
+ yield comp;
175
+ }
176
+ }
177
+ if (includeChildren === true) {
178
+ for (const ch of instance.children) {
179
+ yield* foreachComponentEnumerator(ch, type, true, maxLevel, _currentLevel + 1);
180
+ }
181
+ }
182
+ }
183
+
166
184
  function internalForEachComponent(instance: Object3D, cb: ForEachComponentCallback, recursive: boolean, level: number = 0): any {
167
185
  if (!instance) return;
168
186
  if (!instance.isObject3D) {
@@ -512,6 +512,17 @@ export class Input extends EventTarget {
512
512
  private onDown(evt: PointerEventArgs) {
513
513
  if (debug) console.log(evt.pointerType, "DOWN", evt.button);
514
514
  if (!this.isInRect(evt)) return;
515
+
516
+ // check if we received an mouse UP event for a touch (for some reason we get a mouse.down for touch.up)
517
+ if (evt.pointerType === PointerType.Mouse) {
518
+ const upTime = this._pointerUpTimestamp[evt.button];
519
+ if (upTime > 0 && upTime === evt.source?.timeStamp) {
520
+ // we received an UP event for a touch, ignore this DOWN event
521
+ if(debug) console.log("Ignoring mouse.down for touch.up");
522
+ return;
523
+ }
524
+ }
525
+
515
526
  this.setPointerState(evt.button, this._pointerPressed, true);
516
527
  this.setPointerState(evt.button, this._pointerDown, true);
517
528
  this.setPointerStateT(evt.button, this._pointerEvent, evt.source);
@@ -49,10 +49,20 @@ class MathHelper {
49
49
  return radians * 180 / Math.PI;
50
50
  }
51
51
 
52
+ readonly Rad2Deg = 180 / Math.PI;
53
+
52
54
  toRadians(degrees: number) {
53
55
  return degrees * Math.PI / 180;
54
56
  }
55
57
 
58
+ readonly Deg2Rad = Math.PI / 180;
59
+
60
+ readonly Epsilon = 0.00001;
61
+
62
+ tan(radians: number) {
63
+ return Math.tan(radians);
64
+ }
65
+
56
66
  gammaToLinear(gamma: number) {
57
67
  return Math.pow(gamma, 2.2);
58
68
  }
@@ -98,8 +98,8 @@ export function setWorldScale(obj: Object3D, vec: Vector3) {
98
98
  const tempVec = _worldScale2;
99
99
  const obj2 = obj.parent;
100
100
  obj2.getWorldScale(tempVec);
101
- tempVec.divide(vec);
102
- obj.scale.copy(tempVec);
101
+ obj.scale.copy(vec);
102
+ obj.scale.divide(tempVec);
103
103
  }
104
104
 
105
105
  const _forward = new Vector3();
@@ -176,6 +176,10 @@ export class Animation extends Behaviour {
176
176
  return this.internalOnPlay(act, options);
177
177
  }
178
178
  }
179
+ if (!(clip instanceof AnimationClip)) {
180
+ console.warn("Clip is no AnimationClip", clip, "on object: " + this.name)
181
+ return;
182
+ }
179
183
  const act = this.mixer.clipAction(clip);
180
184
  this.actions.push(act);
181
185
  return this.internalOnPlay(act, options);
@@ -7,6 +7,7 @@ import { TypeStore } from "../engine/engine_typestore";
7
7
  import { assign } from "../engine/engine_serialization_core";
8
8
  import { Mathf } from "../engine/engine_math";
9
9
  import { isAnimationAction } from "../engine/engine_three_utils";
10
+ import { isDevEnvironment } from "../engine/debug";
10
11
 
11
12
  const debug = getParam("debuganimatorcontroller");
12
13
  const debugRootMotion = getParam("debugrootmotion");
@@ -407,7 +408,12 @@ export class AnimatorController {
407
408
  }
408
409
  }
409
410
  }
410
- else console.warn("No action", state.motion, this);
411
+ else if (isDevEnvironment()) {
412
+ if (!state["__warned_no_motion"]) {
413
+ state["__warned_no_motion"] = true;
414
+ console.warn("No action", state.motion, this);
415
+ }
416
+ }
411
417
 
412
418
  if (debug)
413
419
  console.log("TRANSITION FROM " + prev?.name + " TO " + state.name, durationInSec, prevAction, action, action?.getEffectiveTimeScale(), action?.getEffectiveWeight(), action?.isRunning(), action?.isScheduled(), action?.paused);
@@ -8,7 +8,7 @@ import { getParam, isMobileDevice } from "../engine/engine_utils";
8
8
 
9
9
  import { Camera as ThreeCamera, Box3, Object3D, PerspectiveCamera, Vector2, Vector3 } from "three";
10
10
  import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls";
11
- import { EventSystem, EventSystemEvents } from "./ui/EventSystem";
11
+ import { AfterHandleInputEvent, EventSystem, EventSystemEvents } from "./ui/EventSystem";
12
12
  import { ICameraController } from "../engine/engine_types";
13
13
  import { setCameraController } from "../engine/engine_camera";
14
14
  import { SyncedTransform } from "./SyncedTransform";
@@ -176,15 +176,22 @@ export class OrbitControls extends Behaviour implements ICameraController {
176
176
  }
177
177
 
178
178
  private onControlsChangeStarted() {
179
- if(this._syncedTransform) {
179
+ if (this._syncedTransform) {
180
180
  this._syncedTransform.requestOwnership();
181
181
  }
182
182
  }
183
183
 
184
184
  private _shouldDisable: boolean = false;
185
- private afterHandleInput() {
186
- if (this._controls && this._eventSystem) {
187
- this._shouldDisable = this._eventSystem.hasActiveUI;
185
+ private afterHandleInput(evt: CustomEvent<AfterHandleInputEvent>) {
186
+ if (evt.detail.args.pointerId === 0) {
187
+ if (evt.detail.args.isDown) {
188
+ if (this._controls && this._eventSystem) {
189
+ this._shouldDisable = this._eventSystem.hasActiveUI;
190
+ }
191
+ }
192
+ else if (!evt.detail.args.isPressed || evt.detail.args.isUp) {
193
+ this._shouldDisable = false;
194
+ }
188
195
  }
189
196
  }
190
197
 
@@ -205,6 +212,7 @@ export class OrbitControls extends Behaviour implements ICameraController {
205
212
 
206
213
  onBeforeRender() {
207
214
  if (!this._controls) return;
215
+ if (this._cameraObject !== this.context.mainCamera) return;
208
216
 
209
217
  if (this.context.input.getPointerDown(0) || this.context.input.getPointerDown(1) || this.context.input.getPointerDown(2)) {
210
218
  this._inputs += 1;
@@ -267,7 +275,7 @@ export class OrbitControls extends Behaviour implements ICameraController {
267
275
  if (this._controls && !this.context.isInXR) {
268
276
  if (this.debugLog)
269
277
  this._controls.domElement = this.context.renderer.domElement;
270
- this._controls.enabled = !this._shouldDisable;
278
+ this._controls.enabled = !this._shouldDisable && this._camera === this.context.mainCameraComponent;
271
279
  this._controls.update();
272
280
  }
273
281
  }