How to make my weapon rotate using Mouse movement

So this is a pretty weird and obscure question. But I want to know, how can I make my sword rotate using mouse movement, like if I hold down Left Mouse Button and turn my mouse to the left my sword will rotate 90 degrees to the left but not my camera.

Basically something like this will work, you have to enable “mouse for touch” in the project settings (you can remove the default virtual joysticks) but this is a quick and easy way to get it done. Otherwise you would have to have a bunch of mouse events to tell when something is clicked vs clicked and held, and released. This needs some tweaking for your specific needs but you can get an idea of how to start from this. You will need to script logic for what to do when it reaches “90 degrees” how to return it back to center and how to change direction but just to rotate a component independent of the camera or parent actor this is one way to do it. You can change how fast it rotates by changing how large the float is that you add to the rotation. Currently it is only 1 degree so very slow.

Ah, I’ll give that a shot. Thanks for the help!
I’ll mark this as the answer once I test it out and see if it tickles my fancy.

So for some reason I can’t connect my sword mesh to “Set Relative Rotation” and the “get world rotation” node doesn’t have any of those green values. I assume it’s because I never enabled “mouse for touch”. How do I enable that? I know you said to enable it in the project settings but where in the project settings?

The sword is just a mesh inside my player blueprint.

Is the sword part of another actor? If not you can’t rotate it with that node

Make sure you have the right node. Easiest way is drag out the component reference from the details panel if the sword and from there drag off a wire and search for set relative rotation. Should get it then.

It’s in the input tab close to the bottom

Alright, I’m gonna try that now. Btw, how do you enable “mouse for touch”? I wanna know this cause you said to enable it in the project settings, but where in the project settings? Sorry I asked this before, but I just need the answer, lol.

Oooh, well that’s for mobile games though?

■■■■, maybe I didn’t make it clear enough in the main post. I’m not trying to make a mobile game or using the mouse to tap a joystick on the screen. What I’m trying to do is just holding left mouse button to sway my sword around. Not tapping on screen controls.

Here. I’ll post an image showing you my screen. https://i.imgur.com/AZmX7Yv.png
You see that “get world rotation” node? It doesn’t have any of those green nodes like in your blueprint, so I can’t connect my float to the “get world rotation” node. Why’s that?

Sorry been a minute, dunno if you still need help with this but, you need to right click on the purple rotation pin and look for “break rotation” this will give you the x,y,z rotation in a float format.

It’s fine, I kind of forgot/given up on the idea but I’ll still keep it in mind for whenever I decide to use it. Thanks for your help!