@@ -930,19 +930,25 @@
|
|
930
930
|
return true;
|
931
931
|
}
|
932
932
|
|
933
|
+
private _renderlooperrors = 0;
|
934
|
+
|
933
935
|
/** Performs a full update step including script callbacks, rendering (unless isManagedExternally is set to false) and post render callbacks */
|
934
936
|
public update(timestamp: DOMHighResTimeStamp, frame?: XRFrame | null) {
|
935
937
|
if (frame === undefined) frame = null;
|
936
938
|
if (isDevEnvironment() || debug || looputils.hasNewScripts()) {
|
937
939
|
try {
|
938
940
|
this.internalStep(timestamp, frame);
|
941
|
+
this._renderlooperrors = 0;
|
939
942
|
}
|
940
943
|
catch (err) {
|
941
|
-
|
942
|
-
|
944
|
+
this._renderlooperrors += 1;
|
945
|
+
if ((isDevEnvironment() || debug) && (err instanceof Error || err instanceof TypeError))
|
946
|
+
showBalloonMessage("Caught unhandled exception during render-loop.<br/>Stopping renderloop...<br/>See console for details.", LogType.Error);
|
943
947
|
console.error(err);
|
944
|
-
|
945
|
-
|
948
|
+
if (this._renderlooperrors > 10) {
|
949
|
+
console.warn("Stopping render loop due to error")
|
950
|
+
this.renderer.setAnimationLoop(null);
|
951
|
+
}
|
946
952
|
this.domElement.dispatchEvent(new CustomEvent("error", { detail: err }));
|
947
953
|
}
|
948
954
|
}
|
@@ -1171,11 +1177,8 @@
|
|
1171
1177
|
}
|
1172
1178
|
this._isRendering = true;
|
1173
1179
|
this.renderRequiredTextures();
|
1174
|
-
|
1175
|
-
// if (this.mainCameraComponent.activeTexture) {
|
1180
|
+
|
1176
1181
|
|
1177
|
-
// }
|
1178
|
-
// }
|
1179
1182
|
if (this.composer && !this.isInXR) {
|
1180
1183
|
this.composer.render(this.time.deltaTime);
|
1181
1184
|
}
|
@@ -1003,6 +1003,14 @@
|
|
1003
1003
|
// sync
|
1004
1004
|
const pos = body.translation();
|
1005
1005
|
const rot = body.rotation();
|
1006
|
+
if (Number.isNaN(pos.x) || Number.isNaN(rot.x)) {
|
1007
|
+
if (!col["__COLLIDER_NAN"] && isDevEnvironment()) {
|
1008
|
+
console.warn("Collider has NaN values", col.name, col.gameObject, body);
|
1009
|
+
col["__COLLIDER_NAN"] = true;
|
1010
|
+
}
|
1011
|
+
continue;
|
1012
|
+
}
|
1013
|
+
|
1006
1014
|
// make sure to keep the collider offset
|
1007
1015
|
const center = obj["center"] as Vector3;
|
1008
1016
|
if (center && center.isVector3) {
|
@@ -552,6 +552,13 @@
|
|
552
552
|
// Temporary override children
|
553
553
|
const children_length = obj.children;
|
554
554
|
obj.children = emptyChildren;
|
555
|
+
// TODO: validate that object doesn't contain NaN values
|
556
|
+
const pos = obj.position;
|
557
|
+
const scale = obj.scale;
|
558
|
+
if (Number.isNaN(pos.x) || Number.isNaN(pos.y) || Number.isNaN(pos.z)) {
|
559
|
+
console.warn(`Object \"${obj.name}\" has NaN values in position or scale.... will ignore it`, pos, scale);
|
560
|
+
return;
|
561
|
+
}
|
555
562
|
box.expandByObject(obj, true);
|
556
563
|
obj.children = children_length;
|
557
564
|
}
|
@@ -573,6 +580,10 @@
|
|
573
580
|
|
574
581
|
box.getSize(size);
|
575
582
|
box.setFromCenterAndSize(center, size);
|
583
|
+
if( Number.isNaN(size.x) || Number.isNaN(size.y) || Number.isNaN(size.z)){
|
584
|
+
console.warn("Camera fit size resultet in NaN", camera, box, [...objects]);
|
585
|
+
return;
|
586
|
+
}
|
576
587
|
if (size.length() <= 0.0000000001) {
|
577
588
|
if (debugCameraFit) console.warn("Camera fit size is zero", box, [...objects]);
|
578
589
|
return;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TypeStore } from "./../engine_typestore.js"
|
2
|
-
|
2
|
+
|
3
3
|
// Import types
|
4
4
|
import { __Ignore } from "../../engine-components/codegen/components.js";
|
5
5
|
import { ActionBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js";
|
@@ -219,7 +219,7 @@
|
|
219
219
|
import { XRGrabRendering } from "../../engine-components/webxr/WebXRGrabRendering.js";
|
220
220
|
import { XRRig } from "../../engine-components/webxr/WebXRRig.js";
|
221
221
|
import { XRState } from "../../engine-components/XRFlag.js";
|
222
|
-
|
222
|
+
|
223
223
|
// Register types
|
224
224
|
TypeStore.add("__Ignore", __Ignore);
|
225
225
|
TypeStore.add("ActionBuilder", ActionBuilder);
|