Weird anchor behavior when using Set Position

I’m trying to achieve something similar to the dialogue speech bubbles seen in A Short Hike:

My widget accepts a world position vector, then uses this logic here to move it to the right location:

Producing this result (which is correct):

As you can probably tell, the anchor is currently at 0,0:
image

I want to be able to move the anchor so that I can have it located somewhere else; for example the speech bubble tail when I add it:

Except when I do that, everything breaks:

What am I doing wrong? What do I need to do differently to achieve this speech bubble effect?

Do you have other stuff in this widget except the single speech bubble? If not, I would rather use the Set Position in Viewport as it’s more straight forward.

image

Also center your anchor to the middle. Generally speaking you shouldn’t move anchors to relocate widget, it’s more like a literal “anchor”, so you anchor it to a point you want it to stay relatively the same distance to, no matter what the size of the screen is.

In case of “world space” widgets I usually center them to the middle, in that case you know the center of the widget will be exactly at the world location.

That’s the thing. When I set my anchor to the middle it breaks the entire widget in the same way. I’d like to understand why that’s the case, rather than use a workaround which doesn’t expand my understanding of UMG.

For anyone having the same issue, my solution was as follows:

Use a canvas as the root so that I can offset the contents around 0,0 (using Alignment 0.5, or whatever I require)

image

Then when I need to, I can use Set Render Transform to offset the widget to the world posititon I want it to stick to.

The result is the centre of my square at the world position of my actor:

Hope this helps people!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.