Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Anyone have any ideas on GTA style buildings

This topic is 6320 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am interested in doing a game and I want the buildings to be like GTA (Grand Theft Auto). This portion of the code needs to go fast. What I was thinking was that, since I will never zoom out, there shouldn''t need to be any matrix math and that given the X, Y, and Z pos (in screen space, not world space), there should be a consistent equation to project it onto the screen. Can anyone think of any equation which might to this? My description probably sounds about as clear as mud. Thanks, Mike Henry

Share this post

Link to post
Share on other sites
Two suggestions:

Use a perspective projection matrix. So you''re not going to need it for much, but on better cards, the transform should be handled by the card rather than the CPU (I think), which could potentially make this faster than anything you can code yourself.

If you have to do it yourself, make sure your "virtual Z coordinate" will always be positive (non-zero). Then do your drawing in reverse Z order (i.e. ground first, tops of buildings last). Before the last draw command, divide your X and Y values by the Z value. That _should_ be all you need to do. Oh, and you might want to divide by a scalar times the Z value, so things don''t look TOO distorted... or you could just adjust what Z values you use accordingly.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!