@needle-tools/engine 3.26.1-beta → 3.26.2-beta
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 +118 -102
- package/dist/needle-engine.light.js +80 -64
- package/dist/needle-engine.light.min.js +24 -24
- package/dist/needle-engine.light.umd.cjs +24 -24
- package/dist/needle-engine.min.js +104 -104
- package/dist/needle-engine.umd.cjs +134 -134
- package/lib/engine/engine_context.d.ts +1 -0
- package/lib/engine/engine_context.js +9 -8
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_physics_rapier.js +7 -0
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine-components/OrbitControls.js +11 -0
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/codegen/register_types.ts +2 -2
- package/src/engine/engine_context.ts +11 -8
- package/src/engine/engine_physics_rapier.ts +8 -0
- package/src/engine-components/OrbitControls.ts +11 -0
|
@@ -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 @@ import { XRGrabModel } from "../../engine-components/webxr/WebXRGrabRendering.js
|
|
|
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);
|
|
@@ -930,19 +930,25 @@ export class Context implements IContext {
|
|
|
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 @@ export class Context implements IContext {
|
|
|
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 @@ export class RapierPhysics implements IPhysicsEngine {
|
|
|
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 @@ export class OrbitControls extends Behaviour implements ICameraController {
|
|
|
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 @@ export class OrbitControls extends Behaviour implements ICameraController {
|
|
|
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;
|