diff --git a/crates/bevy_transform/src/components/global_transform.rs b/crates/bevy_transform/src/components/global_transform.rs index d964442ca2cfa..bb0d5b6105614 100644 --- a/crates/bevy_transform/src/components/global_transform.rs +++ b/crates/bevy_transform/src/components/global_transform.rs @@ -75,35 +75,23 @@ impl GlobalTransform { } #[inline] - pub fn right(&self) -> Vec3 { + /// Get the unit vector in the local x direction + pub fn local_x(&self) -> Vec3 { self.rotation * Vec3::unit_x() } #[inline] - pub fn left(&self) -> Vec3 { - -self.right() - } - - #[inline] - pub fn up(&self) -> Vec3 { + /// Get the unit vector in the local y direction + pub fn local_y(&self) -> Vec3 { self.rotation * Vec3::unit_y() } #[inline] - pub fn down(&self) -> Vec3 { - -self.up() - } - - #[inline] - pub fn forward(&self) -> Vec3 { + /// Get the unit vector in the local z direction + pub fn local_z(&self) -> Vec3 { self.rotation * Vec3::unit_z() } - #[inline] - pub fn backward(&self) -> Vec3 { - -self.forward() - } - #[inline] /// Rotate the transform by the given rotation pub fn rotate(&mut self, rotation: Quat) { diff --git a/crates/bevy_transform/src/components/transform.rs b/crates/bevy_transform/src/components/transform.rs index ce8be11b0c537..d09c0bd247c82 100644 --- a/crates/bevy_transform/src/components/transform.rs +++ b/crates/bevy_transform/src/components/transform.rs @@ -75,35 +75,23 @@ impl Transform { } #[inline] - pub fn right(&self) -> Vec3 { + /// Get the unit vector in the local x direction + pub fn local_x(&self) -> Vec3 { self.rotation * Vec3::unit_x() } #[inline] - pub fn left(&self) -> Vec3 { - -self.right() - } - - #[inline] - pub fn up(&self) -> Vec3 { + /// Get the unit vector in the local y direction + pub fn local_y(&self) -> Vec3 { self.rotation * Vec3::unit_y() } #[inline] - pub fn down(&self) -> Vec3 { - -self.up() - } - - #[inline] - pub fn forward(&self) -> Vec3 { + /// Get the unit vector in the local z direction + pub fn local_z(&self) -> Vec3 { self.rotation * Vec3::unit_z() } - #[inline] - pub fn backward(&self) -> Vec3 { - -self.forward() - } - #[inline] /// Rotate the transform by the given rotation pub fn rotate(&mut self, rotation: Quat) {