diff --git a/crates/bevy_math/src/direction.rs b/crates/bevy_math/src/direction.rs index 8ac785878f..50a5218d74 100644 --- a/crates/bevy_math/src/direction.rs +++ b/crates/bevy_math/src/direction.rs @@ -132,6 +132,20 @@ impl std::ops::Neg for Dir2 { } } +impl std::ops::Mul for Dir2 { + type Output = Vec2; + fn mul(self, rhs: f32) -> Self::Output { + self.0 * rhs + } +} + +impl std::ops::Mul for f32 { + type Output = Vec2; + fn mul(self, rhs: Dir2) -> Self::Output { + self * rhs.0 + } +} + #[cfg(feature = "approx")] impl approx::AbsDiffEq for Dir2 { type Epsilon = f32; @@ -261,6 +275,13 @@ impl std::ops::Mul for Dir3 { } } +impl std::ops::Mul for f32 { + type Output = Vec3; + fn mul(self, rhs: Dir3) -> Self::Output { + self * rhs.0 + } +} + impl std::ops::Mul for Quat { type Output = Dir3; @@ -408,6 +429,13 @@ impl std::ops::Mul for Dir3A { } } +impl std::ops::Mul for f32 { + type Output = Vec3A; + fn mul(self, rhs: Dir3A) -> Self::Output { + self * rhs.0 + } +} + impl std::ops::Mul for Quat { type Output = Dir3A;