Quick ChaseCam shaking fix

The chase camera shakes on the Z axis back and forth because of the snippet below, once you cut it out it works like a charm. But now it doesn’t zoom in and out elegantly, mind you.

[java] if (chasing) {
distance = temp.set(targetLocation).subtractLocal(cam.getLocation()).length();
distanceLerpFactor = Math.min(distanceLerpFactor + (tpf * tpf * chasingSensitivity * 0.05f), 1);
distance = FastMath.interpolateLinear(distanceLerpFactor, distance, targetDistance);
if (targetDistance + 0.01f >= distance && targetDistance - 0.01f <= distance)
{
distanceLerpFactor = 0;
chasing = false;
}
}
[/java]

Yay, my first fix!

2 Likes