• Advertisement
Sign in to follow this  

2d (faux 3d) perspective scaling

This topic is 3270 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 been working on simple 2d first person shooter game to learn flash. You drive around an almost desolate planet looking for space bats to kill. I'm having trouble figuring an equation or algorithm that will realistically scale objects as the player approaches them from a distance. I would like them to scale up slowly when they appear on the horizon but grow increasingly fast as they are approached. I have tried a number of simple equations. The most effective: y = 1/x, where y is the scale (in percentage) of the object and x is the distance to the object. This is on the right track but it needs fine tuning. It scales too fast when you get close. I don't know how to appropriately transform the equation. If anyone knows how I can tweak this or has a better solution I would be very grateful.

Share this post


Link to post
Share on other sites
Advertisement
y=1/x is the right way to go, but you also have to be sure to scale the position as well so that whatever it is slides off to the side before it's too close.

Share this post


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

  • Advertisement