File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -571,8 +571,9 @@ impl Basis {
571571 }
572572}
573573
574- impl core :: ops :: Mul < Basis > for Basis {
574+ impl Mul < Basis > for Basis {
575575 type Output = Self ;
576+
576577 #[ inline]
577578 fn mul ( self , rhs : Self ) -> Self {
578579 Basis :: from_elements ( [
@@ -600,7 +601,7 @@ impl Mul<Vector3> for Basis {
600601
601602 #[ inline]
602603 fn mul ( self , rhs : Self :: Output ) -> Self :: Output {
603- Self :: Output :: new ( self . tdotx ( rhs) , self . tdoty ( rhs ) , self . tdotz ( rhs ) )
604+ self . xform ( rhs)
604605 }
605606}
606607
Original file line number Diff line number Diff line change @@ -534,6 +534,23 @@ godot_test!(
534534mod tests {
535535 use crate :: core_types:: Vector3 ;
536536
537+ /*
538+ * Test introduced due to bug in Basis * Vector3 operator
539+ *
540+ * matching result in GDScript:
541+ * var v1 = Vector3(37.51756, 20.39467, 49.96816)
542+ * var phi = -0.4927880786382844
543+ * var v2 = v1.rotated(Vector3.UP, r)
544+ * print(c)
545+ */
546+ #[ test]
547+ fn rotated ( ) {
548+ let v = Vector3 :: new ( 37.51756 , 20.39467 , 49.96816 ) ;
549+ let phi = -0.4927880786382844 ;
550+ let r = v. rotated ( Vector3 :: UP , phi) ;
551+ assert ! ( r. is_equal_approx( Vector3 :: new( 9.414476 , 20.39467 , 61.77177 ) ) ) ;
552+ }
553+
537554 #[ test]
538555 fn it_is_copy ( ) {
539556 fn copy < T : Copy > ( ) { }
Original file line number Diff line number Diff line change @@ -1017,8 +1017,10 @@ pub trait AsVariant: AsArg<<Self as AsVariant>::Target> {
10171017pub struct Null < T > ( PhantomData < T > ) ;
10181018
10191019impl < T : GodotObject > Null < T > {
1020- /// Creates an explicitly null reference that can be used as a method argument.
1020+ /// Creates an explicit null reference that can be used as a method argument.
1021+ // TODO consider something more idiomatic, like module::null::<T>(), similar to std::ptr::null()
10211022 #[ inline]
1023+ #[ allow( clippy:: self_named_constructors) ]
10221024 pub fn null ( ) -> Self {
10231025 Null ( PhantomData )
10241026 }
You can’t perform that action at this time.
0 commit comments