My Camera moves in the wrong direction when flipped (6DOF Spaceship camera)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By LifeSymbiont

Hello, I am the creator of AI Stories on steam. For one of my next games, I am making a 6DOF game and have run into a strange problem.
When I am looking around with my camera and move the mouse so long downwards or upwards until the spaceship flips, the directions the whole thing is supposed to look is inverted. When it’s inverted, moving to the left with the mouse rotates the spaceship to the right, and moving to the right rotates it to the left. Up and Downwards is still fine, but left and right seems to “flip as well” when the ship is flipped.

I of course want it to continue rotating into the supposed direction completely freely. So, does anyone have a solution for this problem?
Here is my code: hatebin

I don’t have any errors, just this “wrong behavior” I want to get fixed. Can you please help me?

I think if you find a normal vector from some fixed point on the top or bottom of your ship then flip the left-right component’s sign of your input vector based on the sign of the up-down component of the normal vector that should fix the issue you’re having.

timothybrentwood | 2022-12-14 04:03

Hello, Thank you for your answer. I honestly don’t know that much about programming and don’t really know how I would accomplish that. Can you please give me a code example of this workflow? Direct examples tend to help me better :slight_smile:

LifeSymbiont | 2022-12-14 11:38