Let me explain. Opengl defines the X+ as to the right, Y+ as up, and Z- into the screen. I've gotten used to this coordinate system, and it's easy to think in. Except I have 1 issue with it, I've gotten myself stuck with 2 definitions of rotation matrices in my code, and I'm trying to unify them.

I don't have a problem with translation, so for now let's only consider the 3x3 rotation section of the matrix.

Suppose I want to draw an object, unrotated. The 3x3 rotation matrix is just identity:

1 0 0

0 1 0

0 0 1

I also represent the camera's current rotation as a matrix. I form the camera matrix out of the 'look', 'up', and 'right' vectors. Except, the unrotated camera looks into -z, so the unrotated camera matrix is:

1 0 0 //right (+X)

0 1 0 //up (+Y)

0 0 -1 //look (+Z)

I have a few dumb negative signs in my code so that when I'm applying a camera matrix, the above matrix acts like identity. But I want to unify everything, I want applying a matrix to just be applying a matrix. So I have a few options:

1. Switch to right handed: if +Z went into the screen, an unrotated camera, and an unrotated object would have the same identity matrix.

2. Don't form a camera matrix with up, ~~left~~ right *(edit: brain fog/typo)*, and look vectors. Instead use up, left, and 'ass' vectors. Then the problem goes away, but I need to negate the backwards vector to get which way a camera is looking.

3. Something else?

How does everyone else solve or avoid this problem?

Thanks.

### Show differencesHistory of post edits

### #ActualDracoLacertae

Posted 16 March 2013 - 02:11 PM

### #1DracoLacertae

Posted 16 March 2013 - 12:51 PM

Let me explain. Opengl defines the X+ as to the right, Y+ as up, and Z- into the screen. I've gotten used to this coordinate system, and it's easy to think in. Except I have 1 issue with it, I've gotten myself stuck with 2 definitions of rotation matrices in my code, and I'm trying to unify them.

I don't have a problem with translation, so for now let's only consider the 3x3 rotation section of the matrix.

Suppose I want to draw an object, unrotated. The 3x3 rotation matrix is just identity:

1 0 0

0 1 0

0 0 1

I also represent the camera's current rotation as a matrix. I form the camera matrix out of the 'look', 'up', and 'right' vectors. Except, the unrotated camera looks into -z, so the unrotated camera matrix is:

1 0 0 //right (+X)

0 1 0 //up (+Y)

0 0 -1 //look (+Z)

I have a few dumb negative signs in my code so that when I'm applying a camera matrix, the above matrix acts like identity. But I want to unify everything, I want applying a matrix to just be applying a matrix. So I have a few options:

1. Switch to right handed: if +Z went into the screen, an unrotated camera, and an unrotated object would have the same identity matrix.

2. Don't form a camera matrix with up, left, and look vectors. Instead use up, left, and 'ass' vectors. Then the problem goes away, but I need to negate the backwards vector to get which way a camera is looking.

3. Something else?

How does everyone else solve or avoid this problem?

Thanks.