diff --git a/crates/bevy_math/src/direction.rs b/crates/bevy_math/src/direction.rs index c98736960c840..a88d44b6024a4 100644 --- a/crates/bevy_math/src/direction.rs +++ b/crates/bevy_math/src/direction.rs @@ -136,6 +136,11 @@ impl Dir2 { pub fn from_xy(x: f32, y: f32) -> Result { Self::new(Vec2::new(x, y)) } + + /// Returns the inner [`Vec2`] + pub const fn as_vec2(&self) -> Vec2 { + self.0 + } } impl TryFrom for Dir2 { @@ -287,6 +292,11 @@ impl Dir3 { pub fn from_xyz(x: f32, y: f32, z: f32) -> Result { Self::new(Vec3::new(x, y, z)) } + + /// Returns the inner [`Vec3`] + pub const fn as_vec3(&self) -> Vec3 { + self.0 + } } impl TryFrom for Dir3 { @@ -447,6 +457,11 @@ impl Dir3A { pub fn from_xyz(x: f32, y: f32, z: f32) -> Result { Self::new(Vec3A::new(x, y, z)) } + + /// Returns the inner [`Vec3A`] + pub const fn as_vec3a(&self) -> Vec3A { + self.0 + } } impl TryFrom for Dir3A {