diff --git a/src/serialization/sb3.js b/src/serialization/sb3.js index d49365671..99efd2c0b 100644 --- a/src/serialization/sb3.js +++ b/src/serialization/sb3.js @@ -1043,7 +1043,9 @@ const parseScratchObject = function (object, runtime, extensions, zip, assets) { target.y = object.y; } if (object.hasOwnProperty('direction')) { - target.direction = object.direction; + // Sometimes the direction can be outside of the range: LLK/scratch-gui#5806 + // wrapClamp it (like we do on RenderedTarget.setDirection) + target.direction = MathUtil.wrapClamp(object.direction, -179, 180); } if (object.hasOwnProperty('size')) { target.size = object.size;