Camera fly precision fix

This commit is contained in:
Aigars Zeiza 2025-10-10 19:39:42 +03:00
parent 14a92fda91
commit b83802c5f7

View File

@ -452,17 +452,23 @@ class PlanetCamera extends Camera {
fly: (progress: number) => {
let t = ease(progress);
let d = 1 - t;
// camera path and orientations calculation
let g_i = ground_a.smerp(ground_b, d).normalize();
let ground_i = this.planet.getRayIntersectionEllipsoid(new Ray(zero, g_i));
let eye_i: Vec3;
if (t >= 1) {
eye_i = cartesian.clone();
} else {
// camera path calculation
let g_i = ground_a.smerp(ground_b, d).normalize();
let ground_i = this.planet.getRayIntersectionEllipsoid(new Ray(zero, g_i));
let height_i =
this._lonLat.height * d * d * d +
max_h * 3 * d * d * t +
max_h * 3 * d * t * t +
lonlat_b.height * t * t * t;
let height_i =
this._lonLat.height * d * d * d +
max_h * 3 * d * d * t +
max_h * 3 * d * t * t +
lonlat_b.height * t * t * t;
let eye_i = ground_i!.addA(g_i.scale(height_i));
eye_i = ground_i!.addA(g_i.scale(height_i));
}
// camera orientation calculation
let up_i = v_a.smerp(v_b, d);
let look_i = Vec3.add(eye_i, n_a.smerp(n_b, d).negateTo());