update lerp functionn

This commit is contained in:
Andre Henriques 2023-03-15 23:03:51 +00:00
parent cb9eb57a2c
commit 81930f35eb

View File

@ -332,10 +332,17 @@ pub trait Lerp {
impl Lerp for f64 { impl Lerp for f64 {
fn lerp(self, other: &Self, diff: f64) -> Self { fn lerp(self, other: &Self, diff: f64) -> Self {
let delta = diff; let delta = diff;
let lerped = self + ((*other - self) * 0.5 * delta);
let change = (*other - self) * 0.1 * delta;
if change < 0.0000001 {
return *other;
}
let lerped = self + change;
if *other != self { if *other != self {
println!("c: {} target:{} lerp: {} diff: {} move: {}", self, other, lerped, diff, (*other - self) * 0.5); println!("c: {} target:{} lerp: {} diff: {} move: {}", self, other, lerped, diff, change);
} }
lerped lerped