x

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: How to scale a widget to X% of actual viewport size?

I'm having some serious trouble with UMG and I hope that you can help me :)

In general I want so scale an image so that it's dimensions equals X% of the current viewport size but I can't manage to do this properly. Here's what I did:

  • I created a standard widget and added a size box with an image in it (see settings in the attached screenshot)

alt text

  • Via script I get the current viewport size, calculate 10% of the size and override the dimensions of the size box

alt text

  • I print the results on screen but as you can see in the attached images, the dimensions of the size box do not match any logical size relative to the viewport resolution

  • Example a) The viewport's x width is 1920 pixels and the dimensions of the Sizebox should be 192x192 pixels (which is 10% of the viewport's X size) but it's dimensions are 180x180 pixels:

alt text

  • Example b) The viewport's x width is 640 pixels and the dimensions of the Sizebox should be 64x64 pixels (which is 10% of the viewport's X size) but it's dimensions are 28x28 pixels

alt text

Thanks in advance and best regards, Daniel

Product Version: UE 4.18
Tags:
1920.jpg (76.3 kB)
640.jpg (25.8 kB)
02-settings.jpg (389.8 kB)
more ▼

asked Dec 23 '17 at 01:28 PM in Using UE4

avatar image

polygon
61 6 12 21

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

I think I just found the solution:

alt text

solution.jpg (117.3 kB)
more ▼

answered Dec 23 '17 at 03:34 PM

avatar image

polygon
61 6 12 21

(comments are locked)
10|2000 characters needed characters left

Where you put this function?

more ▼

answered Jan 06 '19 at 12:15 PM

avatar image

eddiescofield
1 1 2

(comments are locked)
10|2000 characters needed characters left
Your answer
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