Fix camera interpolation being wrong

This commit is contained in:
Moulberry committed 2025-03-07 20:24:40 +08:00
1 parent 11fc4c245e
commit 9adbb0f126
2 files changed
+3 -4

No files matched your search

@@ -15,9 +15,9 @@ public record KeyframeChangeCameraPosition(Vector3d position, double yaw, double
KeyframeChangeCameraPosition other = (KeyframeChangeCameraPosition) to; KeyframeChangeCameraPosition other = (KeyframeChangeCameraPosition) to;
return new KeyframeChangeCameraPosition( return new KeyframeChangeCameraPosition(
this.position.lerp(other.position, amount, new Vector3d()), this.position.lerp(other.position, amount, new Vector3d()),
Interpolation.linear(this.yaw, other.yaw, amount), Interpolation.linearAngle(this.yaw, other.yaw, amount),
Interpolation.linear(this.pitch, other.pitch, amount), Interpolation.linearAngle(this.pitch, other.pitch, amount),
Interpolation.linear(this.roll, other.roll, amount) Interpolation.linearAngle(this.roll, other.roll, amount)
); );
} }
} }
@@ -167,7 +167,6 @@ public class KeyframeTrack {
rightChange = hermiteChange; rightChange = hermiteChange;
} }
} }
// todo: hermite
if (leftChange == null || rightChange == null) { if (leftChange == null || rightChange == null) {
double adjustedAmount = SidedInterpolationType.interpolate(leftInterpolation, rightInterpolation, amount); double adjustedAmount = SidedInterpolationType.interpolate(leftInterpolation, rightInterpolation, amount);