Sign in to follow this  
MrRoboman

2d (faux 3d) perspective scaling

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this