File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -623,10 +623,13 @@ fn pan_orbit_camera(
623623
624624 // 2 - Process input into target yaw/pitch, or focus, radius
625625
626+ // Only check for upside down when orbiting started or ended this frame,
627+ // so we don't reverse the yaw direction while the user is still dragging
626628 if orbit_button_changed {
627- // Only check for upside down when orbiting started or ended this frame,
628- // so we don't reverse the yaw direction while the user is still dragging
629- let wrapped_pitch = ( pan_orbit. target_pitch % TAU ) . abs ( ) ;
629+ // To account for swapped or different axis to identify whether the world is upside down.
630+ let pitch_axis_rotation = Vec3 :: X . dot ( pan_orbit. axis [ 0 ] ) ;
631+ let target_pitch = pan_orbit. target_pitch + pitch_axis_rotation;
632+ let wrapped_pitch = ( target_pitch % TAU ) . abs ( ) ;
630633 pan_orbit. is_upside_down = wrapped_pitch > TAU / 4.0 && wrapped_pitch < 3.0 * TAU / 4.0 ;
631634 }
632635
You can’t perform that action at this time.
0 commit comments