Set Widget image position

Hello,
I’m trying to make a minimap widget and i need to simply set and get the position of an image inside a Widget Blueprint class.
I’ve read that first the widget should be cast to CanvasPanelSlot but if I try to do that, I get a warning saying “Canvas Panel Slot does not inherit from ‘Image’, Cast would always fail”.
So, any idea on how to do that? The situation is the following:


The little white image in the bottom-left corner is the ‘imgMinimap’ image and the blue square inside it is the ‘imgFocus’ image.
I need to continuously update the position of the square that represents the view of the camera, just like in an RTS game.
Below is a reference image of the AoE minimap, just to make it clear on what I’m trying to achieve.

aoak_special_map_minimap_7.png

Ok, so I made it, for the others who need to do the same thing:

I created another Canvas Panel, I made the image I want to move (imgFocus) child of this canvas panel, then I get the imgFocus parent and move it.

1.PNG

Thank you anyway!

1 Like

It’s not necessary. For an image sitting directly in the canvas:

Annotation 2020-07-07 153315.jpg

If you want to use translation instead, you can use it directly with the image, no need to nest things deeper.

9 Likes

Thank you Everynone, right in this moment I optimized the procedure and was about to write here. It’s quite similar to your.
This is my working solution


However, yours seems even better :smiley:

2 Likes