- Home /
Using ViewportToWorldPoint to bound player
Hi
I am developing a sidescroller game in a similar vain to space shooter such as R-Type for a uni project. I am now working on the camera for the game. I have the camera scrolling and now need to bound the player so they cannot move off screen.
I needed help with this as I am not to sure how to stop the player moving off screen. I have used mathf.clamp to stop them on a stationary screen, but how do I stop them when the screen is always scrolling?
Any help is greatly appreciated, thanks :)
That works exactly how I needed it!! Cant believe I never thought of that!! Thank you Jamora!! I think in time I will find a way to achieve the same effect with code on the camera, but this will work for now! Thanks once again!
Answer by Jamora · Sep 20, 2013 at 03:32 PM
Can you keep the camera stationary and move everything else but the player? (Parenting everything you want to move to an empty GameObject will make it easy.)