Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Suppose I have a world defined in typical OpenGL coords.. then the up vector defined for this space is (0,1,0).

Now, if I load a model that is defined with (0,0,1) as its up vector, what are the matrix operation(s) that I need to carry out here to arrive at the 4x4 transformation matrix for the model?

Many thanks.

share|improve this question
add comment

1 Answer 1

The up vector being different basically means that the model is in a different space, where Z inwards represents that what you regard as Y up. To compensate for this, rotate the model vertices 90 degrees over the X-axis (in the right direction). Draw the axes on paper, it'll be clear in a jiffy.

Think of it as this: if you were to rotate the up vector 0, 0, 1 -- how would you do it to make it 0, 1, 0?

Use Google for all about building rotation matrices. Or use glRotate() for a quick test.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.