I have outside data streaming in that I’d like to see as move a dial gage. Like a voltage meter or tachometer. I’d like to do this in UMG. I made a few images that I can bring in that look like a needle and a gage cluster with tick marks. I’d like the needle to rotate based on the streaming data. I don’t have an issue getting the streaming data in and applying it to 3D elements like actors, etc., but how can I apply just a single rotation to the needle in the UMG? I know you can animate the rotation of the UMG elements, but can I expose that with blueprints and rotate it from an outside source and not keyframes? I’m almost sure this is possible, but haven’t been able to find anything about it.
Hello,
Yes this is possible.
I don’t have an instream of data, so in this sample I will use the Game Time. If the data your are streaming in isn’t a float value you’ll need to find a way to convert it to one. For example, if the data is a vector, you can break it into three float values. Once you have your input value in some blueprint, you’ll need a reference to the widget. For this example I’m simply spawning the widget from inside the level blueprint so I already have a reference to it. Once you have a reference to the widget, you can set the rotation angle by exposing the widget element as a variable in the widget designer. Then use the Event OnTick to set the angle of the widget every frame. Finally, set the widgets variable from inside another blueprint, and it will update every frame.
(You could also skip the variable in the widget and set the transform angle directly from the level blueprint, or your blueprint of choice. I personally like controlling widgets with their own variables though, its a little easier to debug that way if anything goes wrong.)
I had to make a few modifications to what I was doing, but it was basically the same. Thanks for making the video, that helped quite a bit. In the HUD Event Graph, I was not able to access the Set Render Transform Angle (even when taking off context sensitivity), but I was able to use the Set Render Transform and expand it out to get access to the angle. I also didn’t use the Level Blueprint and just set an angle variable in my Pawn Blueprint and then in the HUD Event Graph cast to the Pawn BP and got the angle variable. Thanks again!