Skip to content

Fix SplineIK crash cases#117959

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
TokageItLab:fix-splineik
Apr 6, 2026
Merged

Fix SplineIK crash cases#117959
Repiteo merged 1 commit intogodotengine:masterfrom
TokageItLab:fix-splineik

Conversation

@TokageItLab
Copy link
Copy Markdown
Member

@TokageItLab TokageItLab commented Mar 29, 2026

  1. An out-of-bounds access occurred when there was only one point and it was closer than the first segment. I added the case where there is only one point as an OR condition to the abort case in the calculation for the first segment. Fixes SplineIK crash if Path3D Curve only have 1 point #117724.

  2. Because the first segment had a higher priority than the ended flag, there were cases where the first segment was incorrectly searched after ended, which caused an infinite loop (see MRP). I swapped the priority of the flags. Fixes SplineIK3D SplineIK3DSetting::find_nearest_point infinite loop on overlapping Curve3D #114564.

@TokageItLab TokageItLab added this to the 4.7 milestone Mar 29, 2026
@TokageItLab TokageItLab requested a review from a team March 29, 2026 10:45
@TokageItLab TokageItLab requested a review from a team as a code owner March 29, 2026 10:45
@TokageItLab TokageItLab added bug crash topic:animation topic:3d cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release labels Mar 29, 2026
Copy link
Copy Markdown
Contributor

@lyuma lyuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I was able to reproduce the issue and it would be solved by a continue (as in the ended > 0 case we moved first.

Adding some of this information as comments might be helpful to others reading this code.

Tokage says:Processing only when fitting to a spline causes sudden changes, so I am interpolating the tilt based on the distance from the path using fade-in/fade-out.

Regarding the end, for example, if the spline length is 1.5 and there are two bones with a length of 1, the tip of the second bone will not be on the spline. This code is intended to provide a deterministic way to handle the orientation and interpolation in such cases. This behavior is consistent with Blender.

Tokage says:When ended is 0, the joint is on the path; when ended is 1, the joint is in an interpolation state; when ended is 2, no action is taken on subsequent joints.

@Repiteo Repiteo merged commit abfb91d into godotengine:master Apr 6, 2026
20 checks passed
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented Apr 6, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release crash topic:animation topic:3d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SplineIK crash if Path3D Curve only have 1 point SplineIK3D SplineIK3DSetting::find_nearest_point infinite loop on overlapping Curve3D

3 participants