diff --git a/lib/scatter.js b/lib/scatter.js index 168a6e2..0f2a1cb 100644 --- a/lib/scatter.js +++ b/lib/scatter.js @@ -410,7 +410,9 @@ export class AbstractScatter extends Throwable { keepOnStage(velocity, collision = 0.5) { let stagePolygon = this.containerPolygon - if (!stagePolygon) return + // UO: since keepOnStage is called in nextVelocity we need to + // ensure a return value + if (!stagePolygon) return { x: 0, y: 0} let polygon = this.polygon let bounced = this.bouncing() if (bounced) {