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 {
571
571
}
572
572
}
573
573
574
- impl core :: ops :: Mul < Basis > for Basis {
574
+ impl Mul < Basis > for Basis {
575
575
type Output = Self ;
576
+
576
577
#[ inline]
577
578
fn mul ( self , rhs : Self ) -> Self {
578
579
Basis :: from_elements ( [
@@ -600,7 +601,7 @@ impl Mul<Vector3> for Basis {
600
601
601
602
#[ inline]
602
603
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)
604
605
}
605
606
}
606
607
Original file line number Diff line number Diff line change @@ -534,6 +534,23 @@ godot_test!(
534
534
mod tests {
535
535
use crate :: core_types:: Vector3 ;
536
536
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
+
537
554
#[ test]
538
555
fn it_is_copy ( ) {
539
556
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> {
1017
1017
pub struct Null < T > ( PhantomData < T > ) ;
1018
1018
1019
1019
impl < 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()
1021
1022
#[ inline]
1023
+ #[ allow( clippy:: self_named_constructors) ]
1022
1024
pub fn null ( ) -> Self {
1023
1025
Null ( PhantomData )
1024
1026
}
You can’t perform that action at this time.
0 commit comments