mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add some util functions to Ori
This commit is contained in:
parent
74f9945ab3
commit
208438a26c
@ -194,6 +194,24 @@ impl Ori {
|
|||||||
self.rotated(Quaternion::rotation_y(angle_radians))
|
self.rotated(Quaternion::rotation_y(angle_radians))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn rolled_towards(self, dir: Dir) -> Self {
|
||||||
|
dir.projected(&Plane::from(self.look_dir()))
|
||||||
|
.map_or(self, |dir| self.prerotated(self.up().rotation_between(dir)))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pitched_towards(self, dir: Dir) -> Self {
|
||||||
|
dir.projected(&Plane::from(self.right()))
|
||||||
|
.map_or(self, |dir_| {
|
||||||
|
self.prerotated(self.look_dir().rotation_between(dir_))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn yawed_towards(self, dir: Dir) -> Self {
|
||||||
|
dir.projected(&Plane::from(self.up())).map_or(self, |dir_| {
|
||||||
|
self.prerotated(self.look_dir().rotation_between(dir_))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns a version without sideways tilt (roll)
|
/// Returns a version without sideways tilt (roll)
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
Loading…
Reference in New Issue
Block a user