How to make a control mathod like MetaHuman face rig in UMG?

this like a drag and drop widget,but there is a frame limits the point’s movement. And the point is being pulled by center anchor and spring arm. I try the document Creating Drag and Drop UI, it create a virtual widget following my mouse cursor, not the original widget.

thanks bro !

Somewhere in the update, you’re setting a position either in canvas or viewport. You can clamp the vector using the start location as origin.

Now i achieve drag following. but the frame is also difficult.

Somehow I feel that Drag & Drop is not the right way of doing it. I would encapsulate this behaviour inside a widget so you can have more of those areas if necessary (currently you’re moving it within a viewport):

  • here I’m using a canvas to shift an image within it:

The custom event is triggered during onMouseDown.

  • painting (optional direction and/or length of the vector as you’re probably after this data):

Pretty sure there’s half a dozen way to handle this though. The gut feeling tells me there’s a huge gotcha with dragging that would make it finicky to handle. Might be wrong.

1 Like

I follow your method, but the line generated in the upper left corner,and the image stick to mouse cursor. is there some settings wrong?

Here’s the project:

The widget is created in the Level Blueprint, the mouse release is handled there as well - this is needed with this method in case the drag ends up outside the widget and the player conttroller detects release instead of the widget.

If I find the time, I can have a look at drag & drop method for this, too. Maybe it will not be so bad. But the whole idea is to clamp the vector to the local size of the widget that you’re using. Drawing line is done from the centre of the widget to that bounded vector. This part will be similar for whichever method we opt for.

Thanks. this helps a lot . :+1:

There is a little problem. when use in mobile phone, i replace “Get Mouse Position on Viewport” with “Get Input Touc State”, replace “Left Mouse Button” with “Input Touch”, the results were terrible :disappointed_relieved: