[libgdx] Fixed having a physics reset all timeline in a slider animation.

This commit is contained in:
Nathan Sweet 2025-09-23 13:57:06 -06:00
parent 2bd00b192c
commit 64ed135e49
2 changed files with 6 additions and 3 deletions

View File

@ -1903,7 +1903,8 @@ public class Animation {
}
static public interface ConstraintTimeline {
/** The index of the constraint in {@link Skeleton#getConstraints()} that will be changed when this timeline is applied. */
/** The index of the constraint in {@link Skeleton#getConstraints()} that will be changed when this timeline is applied, or
* -1 if a specific constraint will not be changed. */
public int getConstraintIndex ();
}

View File

@ -110,8 +110,10 @@ public class Slider extends Constraint<Slider, SliderData, SliderPose> {
skeleton.constrained(physics[ii]);
} else
skeleton.constrained(constraints[timeline.constraintIndex]);
} else if (t instanceof ConstraintTimeline timeline) //
skeleton.constrained(constraints[timeline.getConstraintIndex()]);
} else if (t instanceof ConstraintTimeline timeline) {
int constraintIndex = timeline.getConstraintIndex();
if (constraintIndex != -1) skeleton.constrained(constraints[constraintIndex]);
}
}
}