Can I please get some help on the steps I need to fix mouse aiming in a top down perspective?


I’m trying to fix the aiming precision for a top-down game, which I should aim where the mouse cursor is.

The character rotation works fine, but since the weapon is not centered, aiming is not so precise as it should be. So I’m trying to implement an Aim Offset to improve that and also provide pitch for aiming up and down.

I added some debug lines and I can see the “triangle” with a right angle in there. I’m a bit rusty on trigonometry but I believe I could find the angle that I need to feed into the Aim Offset to cut that aiming gap. But I’m not 100% clear on the steps, can someone please help me here?

This is my understanding of what needs to be done:

  1. Discover the angle opposite to the right angle in the triangle I got from my debug lines (green/yellow)
  2. This angle should be converted to a XY vector that I can use as pitch/yaw in my 2D Aim Offset.

yeah… I’m still a bit lost :slight_smile:

I added some pictures with references! Any help would be greatly appreciated!