Hey guys
I'm making a top-down shooter with gamepad controls - left stick controls the player while right controls the crosshair. I'm using 8-directional movement for both player and crosshair.
Currently I've managed to use simple formula where crosshair moves freely around the screen but when released it get's back to player's position
Every tick -> cursor: set position to (lerp(Self.X, player.X, 0.025), lerp(Self.Y, player.Y, 0.025))
I'm looking for a method to constrain crosshair's movement to specific distance from and to the player so it can fly away to maximum eg. 100px but also cannot be closer than eg. 30px.
Something like in this image