Matrix Forward's Y is inverted when the angle is >= 180 degrees

I think you’re slightly mis-percieving the relation of the view matrix and camera.

for example in you’re comment here.

    //To account for rotation, create a rotation about the Y with the y angle and an X with the x angle

First.

What is probably happening is you are creating a malformed free camera. Imagine you are in a plane and you pull backwards till it flips upside down now your up is the ground and the sky is down you’re forward vector is 180 degrees from what it was.

Second ideologically.

The CreateLookAt function builds a full orientation matrix with any and all the rotations translations included. You don’t need to multiply a createrotation Y or X with it.

You would do that to the target position or the target up (which is actually the roll component) if you liked but not to the view matrix this is actually really bad practice that can lead to bugs. The view matrix really should not be altered once you make it.

You alter you’re camera position target up then build the view with the look at function.

The idea is that you have a camera object in the world that you may or may not draw. This is just like any other game object in your world. It has a position, it has its own orientation, its own up forward and right.

The only difference is its the one you picked to use as you’re camera and you will create the view matrix from it as well as what you choose to be its target to look at and from what you want this game objects up vector to be which is again what will end up being your camera roll or not.

Conceptually its like so.

        viewSpace = Matrix.CreateLookAt
            (
            worldObjectToUseAsCamera.Position,
            worldObjectToUseAsCamera.Position + worldObjectToUseAsCamera.Target.Position,
            worldObjectToUseAsCamera.world.Up
            );

The Target.Position can be another game object or it can just a be a normal direction that you rotate with all the aformentioned create rotations same thing for the up you can rotate it if you want or just leave it as vector3.up you can make it a free up by creating it from the right and forward with a crossproduct ect.

Remember there is a create world function as well so really you can use that on all your game objects including you’re camera one to orient them and then just use that world matrix forward.

This is a pretty old camera class i made but my newer ones are basically the same just with more options and some kinks for really crazy stuff worked out. If you want to take a look maybe it will help.

The above is technically a free cam just as if you were in a space sim but you could just lock the vector3.Up in. The above uses matrix’s but the free cam itself cannot actually gimble lock because the up is in free motion that however can do the flip i described properly.