I've got the player controlled using the arrow/wsad keys. Aiming is done with the mouse. This setup should be familiar with just about everyone.
I want it so the camera is always centered at a point between the player and the cross-hairs. Furthermore, that cross-hairs cannot move beyond a certain distance away from the player.
I've successfully completed this aiming/scrolling system but its extremely imperfect. The biggest problem is if the player attempts to move the mouse beyond the fixed radius, everything starts shaking and rotating towards 0 degrees.
If theres some sort of established way of doing this that I'm not aware of, please share.
if the distance between the cross-hair and player is less than the maximum distance, allow it to move and rotate, otherwise just make it rotate on the fixed radius using trigonometry.
X position: rcos(a)
Y position: rsin(a)
(relative to the player)
"r" is the maximum radius and "a" is the angle between the player and the crosshair.