Created InterpolationUtils class with a method to fix the Euler Rotation Break problem Create AdvancedPositionSplineInterpolation and AdvancedPositionLinearInterpolation which always use the shortest possible paths between the Euler Rotation values of the Camera's Yaw and Roll Remove Position Keyframe filtering when adding the Keyframe. This is now done by the AdvancedPositionInterpolation classes
29 lines
973 B
Java
29 lines
973 B
Java
package eu.crushedpixel.replaymod.interpolation;
|
|
|
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
|
import eu.crushedpixel.replaymod.utils.InterpolationUtils;
|
|
|
|
public class AdvancedPositionLinearInterpolation extends GenericLinearInterpolation<AdvancedPosition> {
|
|
|
|
@Override
|
|
public void addPoint(AdvancedPosition point) {
|
|
double normalizedYaw = (point.getYaw() + 180) % 360;
|
|
double normalizedRoll = (point.getRoll()) % 360;
|
|
|
|
if(!points.isEmpty()) {
|
|
AdvancedPosition last = points.get(points.size()-1);
|
|
|
|
double yaw = InterpolationUtils.fixEulerRotation(last.getYaw(), point.getYaw(), 180);
|
|
double roll = InterpolationUtils.fixEulerRotation(last.getRoll(), point.getRoll(), 0);
|
|
|
|
point.setYaw(yaw);
|
|
point.setRoll(roll);
|
|
} else {
|
|
point.setYaw(normalizedYaw-180);
|
|
point.setRoll(normalizedRoll);
|
|
}
|
|
|
|
super.addPoint(point);
|
|
}
|
|
}
|