Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UMG Button positioned wrong


Thought I'd save myself the trouble of trial and error and ask here of those who already know:

I have two UMG buttons, I have one positioned where I want. The other is on the opposite side of the screen, the same distance from the right edge horizontally. I am using Local to Viewport node to compare the Touch location to where these buttons are, so I can use them as virtual joysticks (the engine's built in Touch Interface does not meet my needs).

The left hand one works great, but the right hand one always gets something wrong.

I gave them both an upper-left corner anchor in the Canvas, and on Construct, I move the Right thumbstick button to be as far left of the right side as the Left thumbstick is from the left side, by taking the Left Thumbstick's X position and subtracting it from the owning player's viewport width.

For some reason, doing the math that way results in the Right thumbstick being just slightly right of center on the screen instead of mirroring the left thumbstick

What am I doing wrong?

I think I need to do another geometry-based coordinate conversion but I predict it will take me hours of trial and error (based on past experience) to figure out the magic combination since I don't understand what really happens with those nodes, and I can't access the geometry struct in a construct event.

I'll have to move the logic to a sequence with a DoOnce on the Tick or is there some other event I can use?

SO I guess that's two questions.

Product Version: UE 4.20
more ▼

asked Oct 07 '18 at 06:40 PM in Using UE4

avatar image

3.7k 18 23 20

avatar image Everynone Oct 07 '18 at 09:06 PM

Before you do the calculations, place a Force Layout Prepass node. It kind of helps the widget guess its desired size immediately rather than during its tick. Since you're moving some elements on Construct, the widget size may change, affecting the geometry. Not sure if it's going to help here, though. Worth trying.

avatar image mightyenigma Oct 07 '18 at 11:55 PM

thanks I never knew about that node. I will try it. My current strategy to accomplish that was to put a delay 0ms node first but if force layout prepass has geometry pin then yay!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question