From 6b7ac88d8540a4b2fb0e0fa6f06e75cfb3a4fef0 Mon Sep 17 00:00:00 2001 From: LeXXik Date: Fri, 27 Sep 2024 14:11:06 +0300 Subject: [PATCH] add guard --- src/physics/jolt/front/body/component.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/physics/jolt/front/body/component.mjs b/src/physics/jolt/front/body/component.mjs index a7b5bd6..f5f0427 100644 --- a/src/physics/jolt/front/body/component.mjs +++ b/src/physics/jolt/front/body/component.mjs @@ -1461,6 +1461,14 @@ class BodyComponent extends ShapeComponent { } writeComponentData(cb) { + if (this._motionType !== MOTION_TYPE_STATIC && this._allowedDOFs === 0) { + if ($_DEBUG) { + Debug.warn('Body cannot have all degrees of freedom locked (allowedDOFs === 0)' + + ' and have non-static motion type.'); + } + return; + } + const ok = ShapeComponent.writeShapeData(cb, this); if ($_DEBUG && !ok) { Debug.warn('Error creating a shape.');