camera projection seems wrong

Started by
-1 comments, last by Nebu 15 years, 11 months ago
hello, im working on a simple 3d engine not using any api. some info - my matrix multiplication is as: a*b=rows of a*columns of b, z points into the screen, and im trying to implement a vector (uvn) camera first person view atm, controlled by arrows for movement and mouse for rotation. my camera code is partly taken from a tutorial for opengl which i dont know who wrote. the current problem im having is that after rotating the camera 45 degrees it seems as if it rotated 90. yet when i move forward, it seems to move to the right direction, 45 degrees. also the projection just seem naturally wrong but it seems to be fixed when the projection scale is set to 256 (this feels like more of a hack to me, as if you're hiding small inacurracies by making them smaller). anyways i was hoping someone could point the problem to me so i uploaded my code: download since the program loads objects from a file, you'll have to extract to the same directory i used which is C:\Ido\Aharon. code is a bit messy and needs some work, though it shouldnt be a problem. to make it easier for you some notes - VertexF is an array of triangles which is used to store the current object's faces to be drawn in 3d, and are then converted to screen space and stored in VertexI. game.cpp contains main loop, draw world function. matrix.cpp contains matrix related functions including calculation of view matrix and perspective conversion. some operation notes (mainXXX.exe) - 128 and 256 are the projection scales used in the two builds. use up,down,left,right to move move mouse left and right to rotate view press END key to exit the program if you cant see the problem do as following, open main.exe, rotate until you see ANGX=0,move left and backwards a bit so when you rotate objects wont get all over your screen, now rotate until 45 degrees, and see as it displays as if you rotated 90. by moving forward you'll see the movment is correct. tried to make this post as informative as possible, hope someone can help me with this because i haven't got a clue. thanks in advance [Edited by - Nebu on May 10, 2008 12:39:36 AM]

This topic is closed to new replies.

Advertisement