- Home /
keep character on screen
I am an absolute noob and I'm trying to make a top down shooter like the old arcade games Raiden, 1942 etc. So far I've got the camera scrolling and the character moving correctly, but I cant figure out how to keep from moving off the screen out of frame. I found a couple of references to ViewportToWorldPoint but no real info on how its used. Or maybe there is another way to do what I need to do. Any help would be great.
Use the built-in smooth follow camera script and modify it's parameters (or the code itself) to your liking. Basically you just want to set the camera's transform X and Z to match the player (or Lerp to the same position over time) and then LookAt the player on some interval.
Your answer
![](https://koobas.hobune.stream/wayback/20220613064901im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Custom settings not responding in game as should 1 Answer
STRANGE error with screen.height/screen.width 1 Answer
my MainChara shakes when the Mathf.Clamp stops it from going off screen 1 Answer
How to engage an object if it's seen by my camera?? 1 Answer