Correctly took dot product, switched to square root of dot product

This commit is contained in:
Sam 2021-10-15 22:41:53 -04:00
parent 7b2ade34c4
commit c5c70f6945
2 changed files with 2 additions and 2 deletions

View File

@ -208,7 +208,7 @@ impl Ori {
if angle < PI { angle } else { TAU - angle }
}
pub fn dot(self, other: Self) -> f32 { self.0.dot(other.0) }
pub fn dot(self, other: Self) -> f32 { self.look_vec().dot(other.look_vec()) }
pub fn pitched_up(self, angle_radians: f32) -> Self {
self.rotated(Quaternion::rotation_x(angle_radians))

View File

@ -406,7 +406,7 @@ pub fn handle_orientation(
let rate = {
// Angle factor used to keep turning rate approximately constant by
// counteracting slerp turning more with a larger angle
let angle_factor = 2.0 / (1.0 - update.ori.dot(target_ori));
let angle_factor = 2.0 / (1.0 - update.ori.dot(target_ori)).sqrt();
data.body.base_ori_rate() * efficiency * angle_factor
};
update.ori = update