Help on player's eye view

Hi,

I created a 3D world in which have several players. Now I try to add functions that allow users to choose a player and see the 3D world from the palyer’s eye. What shall I do? Can I just call glGetFloatv(GL_MODELVIEW_MATRIX, matrix), and first apply the inversed matrix when I call display function.

Any help will be appreciated.

Thanks!

Hi there!

The fast answer is YES! :smiley:

It should be has easy as acquiring the modelview matrix from the player (you can keep that updated somewhere in your player’s class or whatever), invert it (this can be somehow tricky to perform correctly and at the same time fast, but there are a lot of info releted on the web. Google for “Matrix FAQ”, it should be easy to find.) and then in the end feed the resulting matrix to OpenGL using glLoadMatrix function.

Hopefully that’s it!!! :wink:

Hope it helped,
hellder.

Me again!

Here’s The Matrix and Quaternion FAQ link:

http://www.j3d.org/matrix_faq/matrfaq_latest.html

Cheers,
hellder

I tried it; but it doesn’t work as I expected. I am sure the inverse of a matrix is correct.

Does someone know more about it? If there is a example, it will be great.

Thanks in advance.

Problem is solved. :wink: