File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
godot-core/src/builtin/vectors
itest/rust/src/builtin_tests/geometry Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ impl Vector3 {
205205
206206 pub fn signed_angle_to ( self , to : Self , axis : Self ) -> real {
207207 let cross_to = self . cross ( to) ;
208- let unsigned_angle = self . dot ( to ) . atan2 ( cross_to . length ( ) ) ;
208+ let unsigned_angle = cross_to . length ( ) . atan2 ( self . dot ( to ) ) ;
209209 let sign = cross_to. dot ( axis) ;
210210 if sign < 0.0 {
211211 -unsigned_angle
Original file line number Diff line number Diff line change @@ -68,3 +68,18 @@ fn vector3_equiv() {
6868 ) ;
6969 }
7070}
71+
72+ #[ itest]
73+ fn vector3_signed_angle_to ( ) {
74+ let outer = Vector3 :: new ( 1.0 , 1.0 , 0.0 ) ;
75+ let inner = InnerVector3 :: from_outer ( & outer) ;
76+
77+ let to = Vector3 :: new ( 1.0 , 1.0 , 1.0 ) ;
78+ let axis = Vector3 :: UP ;
79+
80+ assert_eq_approx ! (
81+ outer. signed_angle_to( to, axis) ,
82+ inner. signed_angle_to( to, axis) as real,
83+ "signed_angle_to\n " ,
84+ ) ;
85+ }
You can’t perform that action at this time.
0 commit comments