[Solved] Making a dynamic 2d crosshair(shooter game)

Currently struggling to figure out how to replicate the camera style seen in 2D shooter games(think Soldat, etc). That is, a camera that, while anchored on a player character, also follows the mouse cursor, in order for a better view of what you’re aiming at. Wracking my brain to try and figure this out.

So the camera is closer to the player but kind of nudges in the direction of the mouse?

Try something like :

That lerp(…, 0.2) just says change the position to 0.2 (or 1/5) of the way between the Player object and the Mouse).

As the mouse moves further away, the distance between camera and player increases.

Doesn’t really work as intended. It was hard for me to explain, but the basic idea is that the camera is still always anchored around the character, even while the mouse is in use. This only seems to work while a button is held down, and only in one direction.

EDIT: I think it does work in both directions, but not sure, might just be a mistake on my part- but yeah, still could use some changes.

You can take out the '“Touch or left mouse button is down”` condition and remove the second event to make it work all the time.

It works in all directions. If it doesn’t work for you, then you’ve made a mistake

Can you screen snip the events you have created?

And the idea with the mouse down condition is that you scroll the mouse around while holding down the LMB.

No need for that first "Center camera on Cat" event. It gets overridden by the second event.

In your second event, you need to replace player with Cat. You want to position the camera based on the player object and mouse. In your case, between Cat and mouse.

My mistake! I must’ve not been paying attention.

It’s easy to do. So it works as you’d like?

Seems to, so far. I guess I’d be coming back to this forum though if there’s any problems in the future! :wink: