|Topic was automatically imported from the old Question2Answer platform.
Hi, I’m looking for help in implementing a top down shooter camera like Enter the Gungeon or Synthetik. That is one that favors the direction of the mouse. The camera moves out towards the mouse but not all the way. I’m having some trouble conceptualizing what is needed to get this done yet alone carrying it out. Any help would be much appreciated.
There are a couple things that need to be done.
First, your script will need to pull the window size, so it knows just how much your camera is showing.
Second, you need to define the max distance the camera can be from the player. This should be defined using the screen size as a variable, so that it works the same on different resolutions.
Third, you need to write a script to move the camera based on the position of your mouse. If your mouse is in the middle of the screen, no movement. If the mouse is at the edge of your screen, the camera moves to its max allowed distance. If the mouse is halfway to the edge, camera moves 50% of the way to its max, etc.
You could also consider including a deadzone around the edge of your screen, so that you don’t need to move your mouse to the very edge of the screen to trigger 100% camera motion.
denxi | 2020-11-08 06:32