mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Correctly took dot product, switched to square root of dot product
This commit is contained in:
parent
7b2ade34c4
commit
c5c70f6945
@ -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))
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user