Aiming in a 2d side scroller

Hello ! I’ve been searching around but i can’t find anything about that, so maybe someone can help me ? I’m looking for a way / tutorial in blueprint to do an aiming system who follows the cursor of the mouse, like in the game Starbound ! It’s very important because i need to do that before continuing the developpement of my game. I already found a turorial to do that i a 3d side scroller but it’s not compatible with a 2d one. Thanks a lot for your time, have a nice day ! :slight_smile:

Get up vector and forward of your player hero.
Find mouse pointer location in world space (google it there are examples). Calculate aiming/direction vector for it (location of player character minus mouse cursor location) both in world space.
Normalize that direction vector.

Now you should have 3 vectors: up vector, forward vector, and aiming vector.

arc cosinus of Dot product for forward and aiming vector is your angle.
arc cosinus of dot for up vector and aiming vector, should give uoi minus or plus sign in case you need -180 to 180 degrees, ie difference up and down aiming.

Also print those arc cos values, i am not quite sure what combination of vectors gives what value, and not at pc right now.

I may create that function later, if you still have troubles.

It would be very gentle if you can do a little video or juste a screen of all the code, sometimes it’s a lot more easy to understand, thanks for the response, it’s kind !

Is there someone who can screen me the necessary code, so i could learn ?