Announcement

Collapse
No announcement yet.

Scaling an image in a UMG widget blueprint dynamically using the event graph

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Scaling an image in a UMG widget blueprint dynamically using the event graph

    Sorry if this is easy to find and I'm just missing it, still trying to wrap my head around how the data flow works in Unreal.

    I'm trying to figure out how to dynamically scale an image using the event graph. It seems that I'd want to add a binding, but there's no button to add bindings for any of the transforms.

    I figure I'm just going about this completely wrong, can someone explain to me how?

    Thanks.

    #2
    You have several options:

    - You could set the scale of your image in the Event Tick of your widget.

    - Create your own function to scale your image inside the widget.

    - Depending on what you doing with your scaling, it also would be possible to create an animation for it inside the widget.

    -It also would be possible to do the binding in any of the other widget options, for example in the visibility binding option. Just set your binding to scale your image inside the visibility binding, and you leave the return node "visible" output pin unchanged.
    Last edited by Shogo999; 07-11-2016, 11:50 AM.

    Comment


      #3
      Ok, thanks, I ended up using a Set Render Scale with my element as the target, seems to work great.

      So next related problem, I have the UMG blueprint inside an actor blueprint using a Widget component. This is the only way I could figure out to put a UMG blueprint into world space rather than flat on the screen. I want to send collision events into the UMG blueprint from the Actor, but I can't for the life of me figure out how to send a variable, or any other information from the parent Actor blueprint into the schematics in the UMG blueprint. I'm sure I'm missing something super basic, but this has been driving me nuts all night.

      Comment


        #4
        I just had an issue like this. My goal was to make the image fit perfectly between two points, and do this dynamically.
        The image, as you start the game must have a base distance to fit into, I believe this is when it is not distorted. At every frame (Tick Event) you get the current distance that the image has to fit in (basically a subtraction, of Pithagore's thesis <if I not butchered the english name of it> in case of diagonal points) and divide its absolute value by the base distance's absolute value. Then use the answer as the desired Y or X value of the scale. If you want to keep aspect ratio, apply to both. If just just want to stretch or compress, jsut use one of them.
        This worked for me, as I was setting up a spring that had to be distorted and I needed cheap (meaning easy to calculate) animations for mobile platforms.

        Comment

        Working...
        X