Original Post
I am still having trouble getting the objects in my baby-FPS to move correctly:
When I rotate the camera to the left (yaw) the object (a square wall directly in front of the camera) starts to rotate but only on the spot. Actually, what happens is that the z-value of the vertices on the right hand side of the wall decrease and the z-value of the vertices on the left hand side of the wall increase but the object does not actually rotate around the camera (which it bloody well should!!!).
My vertices are transformed as follows - Lets say I have a point with local coordinates (-100,100,0) whose origin in the world coordinate system is at (1000,0,1000). The camera can be at (1000,0,900).
1) Convert Local to World -> (900,100,1000)
2) Convert World to Camera -> (-100,100,100) - This assumes that the x, y, and z axis of world space are aligned with those of the camera.
3) Allow for rotation of the camera (say, 45 degrees) around the y-axis (left or right) - multiply (-100,100,100) by:
[cos 45 0 -sin 45]
[ 0 1 0 ]
[sin 45 0 cos 45]
giving (0,100,141.421) which is what you would expect (after calculating the x, y, and z manually). I am assuming that applying the rotation to the point's position relative to the camera will rotate them around the camera - that is correct isn't it?
The program has been thoroughly debugged and has all the correct values at this point. The only other thing I do is divide x and y by z (for perspective) and scale the coordinates to the screen. Could an incorrect projection / field of view cause this strecthing effect?
Sorry to be so vague, Paulcoz.
Edited by - paulcoz on 1/30/00 5:57:26 PM