i have following matrix in game i'm reverse engineering see how works.
i managed capture matrix when model rendered:
0.999971, 0.003148, -0.006994, 0.000000 0.000000, 0.911863, 0.410494, 0.000000 0.006903, -0.410485, 0.911844, 0.000000 -25014.388672, 11944.956055, -19475.357422, 1.000000 i started calculating angle using following:
point calculaterotatation(float modelview[16]) { point result; result.x = atan2(modelview[9], modelview[10]) * (180 / pi); result.y = atan2(-modelview[8], modelview[9]) * (180 / pi); result.z = atan2(modelview[4], modelview[0]) * (180 / pi); return result; } i following: http://db-in.com/blog/2011/04/cameras-on-opengl-es-2-x/
i'm not sure if i'm doing correctly. game not using opengl-es i'm not sure matters.
can of tell me if i'm on right path or if calculate function correct? y-value seems wrong. know there many threads , looked through them don't seem doing have. using dot products , cross products. need confirmation or little help.
edit: know much:
i know calculations x , y rotations correct. if change character's view left right, z increases/decreases. if change character's view height, x increases/decreases. y don't know if right or how it.. have diagram: 
extracting fixed angles rotation matrix can have multiple answers because involving inverse trigonometric , square root. example, if rotation sequence x-y-z (with row vector system), formula below.
anglex = atan2(m11, m22) angley = atan2(-m02, sqrt(m00^2 + m01^2)) anglez = atan2(m01, m00) but, not end of story. i'm sure this article find better way. luck!
Comments
Post a Comment