3D maths to 2D screen coordinates

Started by
10 comments, last by Billy Lee 19 years, 10 months ago
All game objects which need to be intergrated will require three coords. I suggest storing a z coord with all your game objects anyway since this can be used for drawing your sprites in back to front order so that overlapping cases are drawn correctly. It can also be used for scaling sprites so that objects further away appear smaller. As long as your game world doesn't contain too much visual depth this should be sufficient.

With regards to getting the sprites on the screen, if you make your game world and game units (meters etc) correspond to the dimensions of your screen then you should be able to just directly map the coords to screen pixels. Else you will need to store the ratio from screen space to world space to find which pixels correspond to which x, y coords.

[edited by - motorherp on June 7, 2004 5:39:32 AM]
[size="1"] [size="4"]:: SHMUP-DEV ::
Advertisement
quote:Original post by Billy Lee
I''ve just done some research on the internet that to get 2D screen coordinates from a 3D point, you have to divide by the z value. I guess I do need a z-axis then.


There are a few other factors to consider... here are a few threads that might be helpful:

http://gamedev.net/community/forums/topic.asp?topic_id=169402
http://gamedev.net/community/forums/topic.asp?topic_id=189054
http://gamedev.net/community/forums/topic.asp?topic_id=169964
http://gamedev.net/community/forums/topic.asp?topic_id=182181

This topic is closed to new replies.

Advertisement