@needle-tools/engine 3.37.1-alpha → 3.37.2-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.
- package/CHANGELOG.md +3 -0
- package/dist/needle-engine.js +41 -40
- package/dist/needle-engine.light.js +41 -40
- package/dist/needle-engine.light.min.js +48 -47
- package/dist/needle-engine.light.umd.cjs +51 -50
- package/dist/needle-engine.min.js +48 -47
- package/dist/needle-engine.umd.cjs +51 -50
- package/lib/engine/engine_mainloop_utils.d.ts +5 -1
- package/lib/engine/engine_mainloop_utils.js +7 -3
- package/lib/engine/engine_mainloop_utils.js.map +1 -1
- package/lib/engine/webcomponents/api.d.ts +1 -0
- package/lib/engine/webcomponents/api.js +1 -0
- package/lib/engine/webcomponents/api.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +2 -2
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.d.ts +5 -3
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js +3 -4
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js +1 -4
- package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.js +2 -2
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_mainloop_utils.ts +7 -3
- package/src/engine/webcomponents/api.ts +1 -0
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +3 -4
- package/src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts +8 -6
- package/src/engine-components/export/usdz/extensions/behavior/PhysicsExtension.ts +1 -5
- package/src/engine-components/webxr/WebXR.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Material, Mesh, Object3D, Quaternion, Vector3 } from "three";
|
|
2
2
|
|
|
3
3
|
import { isDevEnvironment, showBalloonWarning } from "../../../../../engine/debug/index.js";
|
|
4
4
|
import { serializable } from "../../../../../engine/engine_serialization_decorator.js";
|
|
@@ -10,14 +10,13 @@ import { Animation } from "../../../../Animation.js";
|
|
|
10
10
|
import { Animator } from "../../../../Animator.js";
|
|
11
11
|
import { AudioSource } from "../../../../AudioSource.js";
|
|
12
12
|
import { Behaviour, GameObject } from "../../../../Component.js";
|
|
13
|
-
import { Renderer } from "../../../../Renderer.js";
|
|
14
13
|
import type { IPointerClickHandler, PointerEventData } from "../../../../ui/PointerEvents.js";
|
|
15
14
|
import { ObjectRaycaster,Raycaster } from "../../../../ui/Raycaster.js";
|
|
16
15
|
import { USDDocument, USDObject, USDZExporterContext } from "../../ThreeUSDZExporter.js";
|
|
17
16
|
import { AnimationExtension, RegisteredAnimationInfo, type UsdzAnimation } from "../Animation.js";
|
|
18
17
|
import { AudioExtension } from "./AudioExtension.js";
|
|
19
18
|
import type { BehaviorExtension, UsdzBehaviour } from "./Behaviour.js";
|
|
20
|
-
import { ActionBuilder, ActionModel,
|
|
19
|
+
import { ActionBuilder, ActionModel, BehaviorModel, EmphasizeActionMotionType,type IBehaviorElement, TriggerBuilder } from "./BehavioursBuilder.js";
|
|
21
20
|
|
|
22
21
|
const debug = getParam("debugusdzbehaviours");
|
|
23
22
|
|
|
@@ -583,7 +582,7 @@ export class EmphasizeOnClick extends Behaviour implements UsdzBehaviour {
|
|
|
583
582
|
duration: number = 0.5;
|
|
584
583
|
|
|
585
584
|
@serializable()
|
|
586
|
-
motionType:
|
|
585
|
+
motionType: EmphasizeActionMotionType = "bounce";
|
|
587
586
|
|
|
588
587
|
beforeCreateDocument() { }
|
|
589
588
|
|
|
@@ -234,7 +234,10 @@ export class GroupActionModel implements IBehaviorElement {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/** @internal */
|
|
237
|
-
export type
|
|
237
|
+
export type EmphasizeActionMotionType = "pop" | "blink" | "bounce" | "flip" | "float" | "jiggle" | "pulse" | "spin";
|
|
238
|
+
|
|
239
|
+
/** @internal */
|
|
240
|
+
export type VisibilityActionMotionType = "none" | "pop" | "scaleUp" | "scaleDown" | "moveLeft" | "moveRight" | "moveAbove" | "moveBelow" | "moveForward" | "moveBack";
|
|
238
241
|
|
|
239
242
|
/** @internal */
|
|
240
243
|
export type MotionStyle = "basic";
|
|
@@ -257,7 +260,7 @@ export class ActionModel implements IBehaviorElement {
|
|
|
257
260
|
tokenId?: string;
|
|
258
261
|
affectedObjects?: string | Target;
|
|
259
262
|
easeType?: EaseType;;
|
|
260
|
-
motionType
|
|
263
|
+
motionType: EmphasizeActionMotionType | VisibilityActionMotionType = "none";
|
|
261
264
|
duration?: number;
|
|
262
265
|
moveDistance?: number;
|
|
263
266
|
style?: MotionStyle;
|
|
@@ -306,8 +309,7 @@ export class ActionModel implements IBehaviorElement {
|
|
|
306
309
|
writer.appendLine(`token easeType = "${this.easeType}"`);
|
|
307
310
|
if (this.tokenId)
|
|
308
311
|
writer.appendLine(`token info:id = "${this.tokenId}"`);
|
|
309
|
-
|
|
310
|
-
writer.appendLine(`token motionType = "${this.motionType}"`);
|
|
312
|
+
writer.appendLine(`token motionType = "${this.motionType}"`);
|
|
311
313
|
if (typeof this.moveDistance === "number")
|
|
312
314
|
writer.appendLine(`double moveDistance = ${this.moveDistance} `);
|
|
313
315
|
if (this.style)
|
|
@@ -405,7 +407,7 @@ export class ActionBuilder {
|
|
|
405
407
|
act.duration = duration;
|
|
406
408
|
|
|
407
409
|
act.style = "basic";
|
|
408
|
-
act.motionType =
|
|
410
|
+
act.motionType = "none"; // only VisibilityActionMotionType allowed
|
|
409
411
|
act.moveDistance = 0;
|
|
410
412
|
act.easeType = "none";
|
|
411
413
|
return act;
|
|
@@ -464,7 +466,7 @@ export class ActionBuilder {
|
|
|
464
466
|
return act;
|
|
465
467
|
}
|
|
466
468
|
|
|
467
|
-
static emphasize(targets: Target, duration: number, motionType:
|
|
469
|
+
static emphasize(targets: Target, duration: number, motionType: EmphasizeActionMotionType = "bounce", moveDistance: number = 1, style: MotionStyle = "basic") {
|
|
468
470
|
const act = new ActionModel(targets);
|
|
469
471
|
act.tokenId = "Emphasize";
|
|
470
472
|
act.duration = duration;
|
|
@@ -26,7 +26,7 @@ export class PhysicsExtension implements IUSDExporterExtension {
|
|
|
26
26
|
// see https://developer.apple.com/documentation/realitykit/collisioncomponent#overview
|
|
27
27
|
let temporaryRigidbody: Rigidbody | undefined = undefined;
|
|
28
28
|
if (colliderSource && !rigidBody) {
|
|
29
|
-
rigidBody =
|
|
29
|
+
rigidBody = new Rigidbody();
|
|
30
30
|
rigidBody.isKinematic = true;
|
|
31
31
|
temporaryRigidbody = rigidBody;
|
|
32
32
|
}
|
|
@@ -70,10 +70,6 @@ export class PhysicsExtension implements IUSDExporterExtension {
|
|
|
70
70
|
}
|
|
71
71
|
writer.closeBlock( "}" );
|
|
72
72
|
});
|
|
73
|
-
|
|
74
|
-
// we can remove the temporary component again here
|
|
75
|
-
if (temporaryRigidbody)
|
|
76
|
-
GameObject.removeComponent(temporaryRigidbody);
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
if (colliderSource) {
|
|
@@ -223,7 +223,7 @@ export class WebXR extends Behaviour {
|
|
|
223
223
|
setDefaultMovementEnabled(enabled: boolean): XRControllerMovement | null {
|
|
224
224
|
let movement = this.gameObject.getComponent(XRControllerMovement)
|
|
225
225
|
if (!movement && enabled) {
|
|
226
|
-
movement = this.gameObject.
|
|
226
|
+
movement = this.gameObject.addComponent(XRControllerMovement)!;
|
|
227
227
|
this._createdComponentsInSession.push(movement);
|
|
228
228
|
}
|
|
229
229
|
if (movement) movement.enabled = enabled;
|
|
@@ -233,7 +233,7 @@ export class WebXR extends Behaviour {
|
|
|
233
233
|
setDefaultControllerRenderingEnabled(enabled: boolean): XRControllerModel | null {
|
|
234
234
|
let models = this.gameObject.getComponent(XRControllerModel);
|
|
235
235
|
if (!models && enabled) {
|
|
236
|
-
models = this.gameObject.
|
|
236
|
+
models = this.gameObject.addComponent(XRControllerModel)!;
|
|
237
237
|
this._createdComponentsInSession.push(models);
|
|
238
238
|
models.createControllerModel = this.showControllerModels;
|
|
239
239
|
models.createHandModel == this.showHandModels;
|