Publisher | Juritobi |
---|---|
File size | 241.42kB |
Number of files | 9 |
Latest version | 1.0.0 |
Latest release date | 2024-08-09 07:38:14 |
First release date | 2024-08-09 07:38:14 |
Supported Unity versions | 2018.4.2 or higher |
Usage:
- Add the Script AimCameraComponent to your camera.
- In the component parameters add your player.
- Adjust other parameters to your liking.
How It works:
To move the camera, the viewport mouse position is used, meaning it works relative to the screen size.
Suppose we are always drawing a line from the player to the mouse. We will define distance as the point on this line where the camera is placed, measured from 0 to 1, where 0 is the player's position and 1 is the mouse's position.
the script defines 3 mouse zones:
- form player to InnerZone: where the distance will always be 0, so the camera won't move at all.
- form InnerZone to OuterZone: where distance will be interpolated between 0 and MaxDistance using the specified Curve.
- from OuterZone to the edge of the screen: where the distance will always be equal to MaxDistance.
because the areas are measured relative to the screen size, they will be bigger on the x-axis than on the y-axis.