@@ -1,5 +1,5 @@
|
|
1
1
|
import { TypeStore } from "./../engine_typestore"
|
2
|
-
|
2
|
+
|
3
3
|
// Import types
|
4
4
|
import { __Ignore } from "../../engine-components/codegen/components";
|
5
5
|
import { ActionBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
|
@@ -216,7 +216,7 @@
|
|
216
216
|
import { XRGrabRendering } from "../../engine-components/webxr/WebXRGrabRendering";
|
217
217
|
import { XRRig } from "../../engine-components/webxr/WebXRRig";
|
218
218
|
import { XRState } from "../../engine-components/XRFlag";
|
219
|
-
|
219
|
+
|
220
220
|
// Register types
|
221
221
|
TypeStore.add("__Ignore", __Ignore);
|
222
222
|
TypeStore.add("ActionBuilder", ActionBuilder);
|
@@ -309,6 +309,9 @@
|
|
309
309
|
}
|
310
310
|
|
311
311
|
play(clip: string | undefined = undefined) {
|
312
|
+
// Make sure this is always just a string
|
313
|
+
if (typeof clip !== "string") clip = undefined;
|
314
|
+
|
312
315
|
if (!this.audioLoader || !this.sound || (clip && clip !== this.clip)) {
|
313
316
|
this.loadAndPlay(clip);
|
314
317
|
return;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { EventList } from "../EventList";
|
2
2
|
import { Behaviour } from "../Component";
|
3
|
-
import { ISerializable, SerializationContext, TypeSerializer } from "../../engine/engine_serialization_core";
|
4
|
-
import { eventListSerializer } from "../../engine/engine_serialization_builtin_serializer";
|
5
3
|
import { serializable } from "../../engine/engine_serialization_decorator";
|
4
|
+
import { getParam } from "../../engine/engine_utils";
|
6
5
|
|
6
|
+
const debug = getParam("debugsignals")
|
7
7
|
|
8
8
|
|
9
9
|
export class SignalAsset {
|
@@ -36,6 +36,10 @@
|
|
36
36
|
@serializable(SignalReceiverEvent)
|
37
37
|
events?: SignalReceiverEvent[];
|
38
38
|
|
39
|
+
awake(): void {
|
40
|
+
if(debug) console.log("SignalReceiver awake", this);
|
41
|
+
}
|
42
|
+
|
39
43
|
onEnable(): void {
|
40
44
|
if (this.events) {
|
41
45
|
for (const evt of this.events) {
|
@@ -63,17 +63,17 @@
|
|
63
63
|
onEnterTrigger(trigger: SpatialTrigger): void {
|
64
64
|
if(debug) console.log("ENTER TRIGGER", this.name, trigger.name, this, trigger);
|
65
65
|
trigger.raiseOnEnterEvent(this);
|
66
|
-
this.onEnter?.invoke(
|
66
|
+
this.onEnter?.invoke();
|
67
67
|
}
|
68
68
|
onExitTrigger(trigger: SpatialTrigger): void {
|
69
69
|
if(debug) console.log("EXIT TRIGGER", this.name, trigger.name, this, trigger);
|
70
70
|
trigger.raiseOnExitEvent(this);
|
71
|
-
this.onExit?.invoke(
|
71
|
+
this.onExit?.invoke();
|
72
72
|
}
|
73
73
|
|
74
74
|
onStayTrigger(trigger: SpatialTrigger): void {
|
75
75
|
trigger.raiseOnStayEvent(this);
|
76
|
-
this.onStay?.invoke(
|
76
|
+
this.onStay?.invoke();
|
77
77
|
}
|
78
78
|
}
|
79
79
|
|
@@ -723,6 +723,8 @@
|
|
723
723
|
// if (lastTime === -1) lastTime = time;
|
724
724
|
// this._lastTime = time;
|
725
725
|
|
726
|
+
const estimatedFrameLengthWithPadding = this.director.context.time.deltaTime * 1.5;
|
727
|
+
|
726
728
|
for (let i = 0; i < this.models.length; i++) {
|
727
729
|
const model = this.models[i];
|
728
730
|
const wasTriggered = this.didTrigger[i];
|
@@ -738,7 +740,7 @@
|
|
738
740
|
// }
|
739
741
|
else {
|
740
742
|
const abs = Math.abs(td);
|
741
|
-
if (abs >= .00001 && abs <
|
743
|
+
if (abs >= .00001 && abs < estimatedFrameLengthWithPadding) {
|
742
744
|
isActive = true;
|
743
745
|
}
|
744
746
|
}
|