Add yaw() to Transform.

This commit is contained in:
Nolan Darilek 2022-09-21 13:56:00 -05:00
parent 1837591ba5
commit 0a38e65d26

View File

@ -479,6 +479,17 @@ impl From<&dyn PointLike> for (i32, i32) {
} }
} }
pub trait TransformExt {
fn yaw(&self) -> Angle;
}
impl TransformExt for Transform {
fn yaw(&self) -> Angle {
let forward = self.right();
Angle::Radians(forward.y.atan2(forward.x))
}
}
pub trait GlobalTransformExt { pub trait GlobalTransformExt {
fn yaw(&self) -> Angle; fn yaw(&self) -> Angle;