Rotating objects that stretch...doh!
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
O.k. folks I know this is stupid, but I think replying to this post makes it go back to the top of the list ![](smile.gif)
Paulcoz.
![](smile.gif)
Paulcoz.
Your Right, replying to the post does make it go back to the top....
Back to the top we go.... =)
Back to the top we go.... =)
Another reply so this post doesn''t vanish....I hope this doesn''t get on the moderator''s nerves, there must be an easier way than this??
paulcoz,
I don''t have a lot of time right now, but if I had to guess, it sounds like your camera matrix is wrong. This can cause your objects to flatten out.
First, does everything look okay when the camera is at the origin pointing down the Z-axis. If so, then it is most likely your camera.
I''ll try to give you a better camera description when I have the time to type it all in.
I don''t have a lot of time right now, but if I had to guess, it sounds like your camera matrix is wrong. This can cause your objects to flatten out.
First, does everything look okay when the camera is at the origin pointing down the Z-axis. If so, then it is most likely your camera.
I''ll try to give you a better camera description when I have the time to type it all in.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement