rotation fixes

This commit is contained in:
2021-08-07 13:58:42 +02:00
parent f9c5c04faa
commit bff41ecd89

View File

@@ -437,17 +437,16 @@ impl InputState {
let v2_n = v2.normalize();
let direction = v1_n.dot(norm_n) - v2_n.dot(norm_n);
let rotation = f64::abs(direction);
let distance = (v1.magnitude() + v2.magnitude()) / 2.;
(rotation * distance * f64::signum(direction)) as f32
(direction * distance) as f32
},
(Some(v1), None) => {
let direction = v1.normalize().dot(norm_n);
(v1.magnitude() * f64::signum(direction)) as f32
(direction * v1.magnitude()) as f32
},
(None, Some(v2)) => {
let direction = v2.normalize().dot(norm_n);
(v2.magnitude() * f64::signum(direction)) as f32
(-direction * v2.magnitude()) as f32
},
(None, None) => { 0.0 }
}