Download

Simple UMG Material Compass

Hi all. I’m trying to get a simple compass working.

I was reading the info at the bottom of this page https://answers.unrealengine.com/questions/272854/best-way-to-make-ui-compass.html
This shows the end result I want. But its done in code and i’m not sure where to implement it via blueprints.

Here is how I’m calculating the angle in my character class.
Compass Function…
846a5a1b74e66804e095d77ed338ccc194f31ef0.png
Character Event Graph…
Z0xQhBU.png

This is the material I’m using.
PRpMINM.png

This is the setup in the event graph of the Widget Blueprint.
ug6cvYM.png

Do I need to bind the image in the widget? I just can’t see how this is done…

Any ideas? This is driving me nuts. It seems like something that should be so simple but I just can’t figure it out.

Thanks in advance everyone!
Any help is very much appreciated.

Assign the material to the image widget in the designer, then there’s a function you can use on the image widget. I think it’s just called GetDynamicMaterial - and that will handle creating and swapping it on the brush.

Right. I really have no idea how to do this… I’ve looked and looked for some info on it but I cant find anything. And nothing I’ve tried seems to work.

This is the event graph in the compass widget currently. But the compass doesn’t move.
926b28a61ab3aa4b374d67559613565e30d69496.png

Here is the designer view.
af97e0beec0e87318edb63671213c4a683628c22.png

You’re not actually saving the created MID. You should delete the “Create Dynamic Material Instance” node and the set node you have - and instead add a set node for the results of the “Get Dynamic Material” call - That is the MID you need to update every frame. Is your pan really a vector parameter? I would have thought scalar.

Something like this?
575d40e8f71399e568f45e37e64ddfafae4ae594.png

I dont get how your supposed to create the dynamic material. And do you reference a material, or a material instance??

I’m literally banging my head against a wall trying to do this. None of it seems logical.

Thanks for the help.

“Get Dynamic Material” creates the MID. It swaps out the MI on the brush you set in the designer. You don’t need that other brush member.