File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
gdnative-core/src/core_types Expand file tree Collapse file tree 2 files changed +20
-2
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 > ( ) { }
You can’t perform that action at this time.
0 commit comments