Skip to content

Commit

Permalink
add guard
Browse files Browse the repository at this point in the history
  • Loading branch information
LeXXik committed Sep 27, 2024
1 parent 675550a commit 6b7ac88
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/physics/jolt/front/body/component.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down

0 comments on commit 6b7ac88

Please sign in to comment.