How to use a crosshair to aim a weapon

So I’m working on a simple game to test out some mechanics that I want to use in a more complex game. Basically, I want to use a crosshair controlled by the mouse to aim a cannon. I got the cannon firing projectiles using the left mouse button and I created a crosshair that can be controlled by the mouse (thanks to a tutorial by Peter L. Newton). Now I just need to get the crosshair to aim the cannon. I’m thinking that the crosshair should represent a certain distance directly in front of the cannon and that the cannon would pitch and yaw so that it will always point toward that space. I have attached a screen shot. As you can see, it is a fixed camera position and the cannon is off center. I don’t want the camera to move, just the mouse cursor and the cannon.

If anyone can help me out I would greatly appreciate it. Thank you! :slight_smile:

would something like this work for you: How to Trace from screen mouse position to target in Blue Print - Programming & Scripting - Unreal Engine Forums

Do a trace from your cursor forward and get the world space it is hovering over, then point your cannon in that direction.