Optimize unnecessary normalizations for Transform::local_{xyz}
(#14171)
Note that `GlobalTransform` already does it like this for `right`, `left`, etc. so I didn't have to touch that one
This commit is contained in:
parent
7ed1f6a9b6
commit
e941264b6f
@ -222,8 +222,8 @@ impl Transform {
|
|||||||
/// Get the unit vector in the local `X` direction.
|
/// Get the unit vector in the local `X` direction.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn local_x(&self) -> Dir3 {
|
pub fn local_x(&self) -> Dir3 {
|
||||||
// Dir3::new(x) panics if x is of invalid length, but quat * unit vector is length 1
|
// Quat * unit vector is length 1
|
||||||
Dir3::new(self.rotation * Vec3::X).unwrap()
|
Dir3::new_unchecked(self.rotation * Vec3::X)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Equivalent to [`-local_x()`][Transform::local_x()]
|
/// Equivalent to [`-local_x()`][Transform::local_x()]
|
||||||
@ -241,8 +241,8 @@ impl Transform {
|
|||||||
/// Get the unit vector in the local `Y` direction.
|
/// Get the unit vector in the local `Y` direction.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn local_y(&self) -> Dir3 {
|
pub fn local_y(&self) -> Dir3 {
|
||||||
// Dir3::new(x) panics if x is of invalid length, but quat * unit vector is length 1
|
// Quat * unit vector is length 1
|
||||||
Dir3::new(self.rotation * Vec3::Y).unwrap()
|
Dir3::new_unchecked(self.rotation * Vec3::Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Equivalent to [`local_y()`][Transform::local_y]
|
/// Equivalent to [`local_y()`][Transform::local_y]
|
||||||
@ -260,8 +260,8 @@ impl Transform {
|
|||||||
/// Get the unit vector in the local `Z` direction.
|
/// Get the unit vector in the local `Z` direction.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn local_z(&self) -> Dir3 {
|
pub fn local_z(&self) -> Dir3 {
|
||||||
// Dir3::new(x) panics if x is of invalid length, but quat * unit vector is length 1
|
// Quat * unit vector is length 1
|
||||||
Dir3::new(self.rotation * Vec3::Z).unwrap()
|
Dir3::new_unchecked(self.rotation * Vec3::Z)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Equivalent to [`-local_z()`][Transform::local_z]
|
/// Equivalent to [`-local_z()`][Transform::local_z]
|
||||||
|
Loading…
Reference in New Issue
Block a user