Hi everyone!
So I'm trying to make a special camera that positions itself at the midpoint between two points (the player and the mouse cursor). I used the midpoint formula to position the camera in the frame;
Please login to see this attachment.
Then I tested the frame and it works well, but the user can move his mouse super far away and see things way off the screen. I decided to add the distance formula to restrict how far away the camera can be from the player;
Please login to see this attachment.
However once the player reaches past the specified distance, the code stops working and the camera isn't positioned (as I expected). The question is, how can I keep the camera from moving past the set distance while still following the mouse and rotating around the player. Imagine a bubble around the player and the max distance would be the edges of the bubble. the mouse should still be able to move and rotate around the player at the fixed max distance. Here's the short few lines of code that I have so far. I assume I'll have to test if the distance is greater than 750 pixels, then add some code...
Please login to see this attachment.