Download

How do I make a 2D character follow the mouse cursor?

Hi guys,

I’m practicing to make a game like Feeding Frenzy where I have to move the 2D character using the mouse. I tried getting cursor location/converting it to world space/get hit result under cursor. Nothing seems to work properly. Any ideas how to make that happen? This is in Blueprints. Thanks!

Some more insight into the type of game would help. Maybe a screenshot.

There are some things with widgets where they drag and drop things. So the 2d widget sticks to the mouse cursor.

But maybe you aren’t using widgets. If you are using a pane with a texture on it, then that’s different. If you are using Niagara sprites and sub images for animation, that’s different.

If I want an in game object on like a flat plane to stick to the mouse cursor I’d probably use something like this.

If you want it to be an actor with a movement component, you can change “set target Location” to “Move to location”

Can maybe ditch some of the code then too.

Although I could be wrong. Maybe this helps.