Closed ghost closed 8 months ago
Can we remove the scale field and instead bind the orthographic camera's scale to radius, as shown in the code below? This would make it easier to switch between perspective and orthographic cameras. If there are no issues, I will submit a PR.
pub fn update_orbit_transform( alpha: f32, beta: f32, mut radius: f32, focus: Vec3, transform: &mut Transform, projection: &mut Projection, basis: &Transform, ) { let mut new_transform = *basis; if let Projection::Orthographic(ref mut p) = *projection { p.scale = radius; // (near + far) / 2.0 ensures that objects near `focus` are not clipped radius = (p.near + p.far) / 2.0; } new_transform.rotation *= Quat::from_rotation_y(alpha) * Quat::from_rotation_x(-beta); new_transform.translation += focus + new_transform.rotation * Vec3::new(0.0, 0.0, radius); *transform = new_transform; }
Can we remove the scale field and instead bind the orthographic camera's scale to radius, as shown in the code below? This would make it easier to switch between perspective and orthographic cameras. If there are no issues, I will submit a PR.