- Home /
2D Infinite Runner - Pan camera by screen height
Hi,
I am working on a 2D infinite runner. So far it's going pretty well. I'm stuck on something that I hope you unity pros might be able to help me with.
I'm planning to make sub levels so that when the runner falls, they're just taken to a different part of the world to run in (like a water level or something). I've got Transform.translate on the camera, but I don't know when to stop. What I'd like to do is have the camera translate one entire screen height. Once translated, the player would start moving again.
Here is a demo of what I have so far. Let the runner run off the edge of the first platform to see the camera pan: http://fanqu.net/demo/
I know I can get the pixelHeight of the camera, but how would I use this in position context?
Any thoughts on this?
Thanks all.
Answer by antk · Mar 06, 2014 at 06:47 PM
So this answer helped: http://answers.unity3d.com/questions/486035/how-to-find-world-coordinates-of-screen-corners-wi.html
And now it's doing what I want it to do. http://fanqu.net/demo/
Thanks all.
Glad you got it working. Click on the checkmark to the left of your answer to accept it and close this question out. Thanks.