Skip to content

Commit

Permalink
Keep processing if target alpha/beta is not the same as current (#13)
Browse files Browse the repository at this point in the history
* Keep processing if target is not the same

* Bump version

* Remove unused import from example
  • Loading branch information
Plonq authored Apr 29, 2023
1 parent 1d057ae commit 0ffff77
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_panorbit_camera"
version = "0.4.0"
version = "0.4.1"
authors = ["Plonq"]
edition = "2021"
description = "A basic pan and orbit camera in Bevy"
Expand Down
1 change: 0 additions & 1 deletion examples/keyboard_controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use bevy::prelude::*;
use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin};
use std::f32::consts::TAU;

fn main() {
App::new()
Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,11 @@ fn pan_orbit_camera(

// 4 - Apply orbit rotation based on target alpha/beta

if has_moved || pan_orbit.force_update {
if has_moved
|| pan_orbit.target_alpha != pan_orbit.alpha
|| pan_orbit.target_beta != pan_orbit.beta
|| pan_orbit.force_update
{
// Interpolate towards the target value
let t = 1.0 - pan_orbit.orbit_smoothness;
let mut target_alpha = pan_orbit.alpha.lerp(&pan_orbit.target_alpha, &t);
Expand Down

0 comments on commit 0ffff77

Please sign in to comment.