{"record":{"id":"b0d0d4489c3ea090","repo":"BabylonJS/Babylon.js","slug":"step-size-should-be-less-than-1","errorCode":null,"errorMessage":"step size should be less than 1.","messagePattern":"step size should be less than 1\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Animations/pathCursor.ts","lineNumber":68,"sourceCode":"     * Moves the cursor behind by the step amount\r\n     * @param step The amount to move the cursor back\r\n     * @returns This path cursor\r\n     */\r\n    public moveBack(step: number = 0.002): PathCursor {\r\n        this.move(-step);\r\n\r\n        return this;\r\n    }\r\n\r\n    /**\r\n     * Moves the cursor by the step amount\r\n     * If the step amount is greater than one, an exception is thrown\r\n     * @param step The amount to move the cursor\r\n     * @returns This path cursor\r\n     */\r\n    public move(step: number): PathCursor {\r\n        if (Math.abs(step) > 1) {\r\n            throw new Error(\"step size should be less than 1.\");\r\n        }\r\n\r\n        this.value += step;\r\n        this._ensureLimits();\r\n        this._raiseOnChange();\r\n\r\n        return this;\r\n    }\r\n\r\n    /**\r\n     * Ensures that the value is limited between zero and one\r\n     * @returns This path cursor\r\n     */\r\n    private _ensureLimits(): PathCursor {\r\n        while (this.value > 1) {\r\n            this.value -= 1;\r\n        }\r\n        while (this.value < 0) {\r","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Animations/pathCursor.ts#L50-L86","documentation":"PathCursor.move(step) advances the cursor along a Curve3 path by a relative amount. Because a single move must stay within one curve segment, absolute step values above 1 are rejected with this error; use multiple smaller moves instead.","triggerScenarios":"Calling pathCursor.move(step) with Math.abs(step) > 1, e.g. move(1.5) or move(-2), directly or indirectly via moveAhead/moveBack with a too-large delta.","commonSituations":"Computing a step from elapsed time without clamping (large frame delta); passing a normalized speed times a too-large factor; misunderstanding that step is a fraction of the segment, not distance.","solutions":["Clamp the step to (-1, 1), e.g. Math.min(Math.abs(step), 1) * Math.sign(step)","Split large movements into multiple moves of <= 1","Normalize the step by the intended traversal time before calling move"],"exampleFix":"// before\ncursor.move(delta * speed); // may exceed 1\n// after\nconst step = Math.max(-1, Math.min(1, delta * speed));\ncursor.move(step);","handlingStrategy":"validation","validationCode":"const step = Math.max(-1, Math.min(1, rawStep));\nif (Math.abs(rawStep) > 1) {\n    console.warn(\"step clamped to\", step);\n}\ncursor.move(step);","typeGuard":null,"tryCatchPattern":"try {\n    cursor.move(rawStep);\n} catch (e) {\n    if (e.message.includes(\"step size should be less than 1\")) {\n        let remaining = Math.sign(rawStep);\n        while (Math.abs(remaining) > 0) {\n            const s = Math.max(-1, Math.min(1, rawStep));\n            cursor.move(s);\n            break;\n        }\n    }\n}","preventionTips":["Clamp all computed steps to [-1, 1] before calling move/moveAhead/moveBack","Remember step is relative to one segment, not absolute distance or time in seconds","Frame-delta based movement must be scaled down and clamped"],"tags":["animation","path3d","cursor","validation"],"backgroundTag":"argument-out-of-range","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}