Jump to content
  • Advertisement
Sign in to follow this  
BasicMind

Scaling.

This topic is 2786 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 have a pseudo 3d game I'm working on. I say pseudo, I am actually using a 3d projection algorithm but for most it has more in common with a pseudo 3d game.

I have game objects that go up and down the z axis, I've botched together a simple scaling factor, It works sort of but I'd rather do it better. Is there a better way to do this?

I am using

screenx = worldx * constant / worldz
screeny = worldy * constant / worldz

game objects only travel up and down the z axis for the most part, I know I could convert every point using the above algorithm but this seems overly verbose and expensive.

currently I'm using

float scaleFactor = 1 - std::max(2 * (zCoord * 0.001), 0.0);

and applying a transformation matrix on both x and y with the result

But this method is hard to tweak and get looking correctly.

Share this post


Link to post
Share on other sites
Advertisement
Ok I've got it working although not elegantly. by saying when z = 0 scaling is 100% when z = max distance scaling = 0% and so on.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!