Widget on arm hud.

by | Oct 17, 2021 | Blog, Tutorial, Unreal Engine 4

I wanted to create a hud on the arm that you could look at, say for temperature or health. Here is a demo of how that turned out. This is done with widgets and materials, taking in use the retainer box.

As you can se in the video there is animation from the widget and also a number that is updated trough the wristmesh actor blueprint.

First I created a mesh that I attached to the arm. I only wanted half of a square UV on that mesh.

What’s important here is that there are two different material id’. One for the plane HUD itself and one for the other mesh. We only want to use the HUD material on the plane in the middle, not on anything else.

After that I needed a widget in UE4, as you can see from the screenshot I would say the most important thing to take away from this is that I use the retainerbox, set the “Texture parameter” to a name I can use. I will set the “Effect Material” parameter trough the actor later. I also had a sizebox after the retainer box set to a square shape. 512×512 or 1024×1024 to keep it consistent with the UV’s on the mesh. Whatever content you wish to show goes into that square. It is also anchored to the middle of the canvas.

On to the material. The most important thing in the material is the parameter the “Texture”, just a normal colour texture. The rest of the settings was mostly for testing, I didn’t end up using the tiling, but the emissive was really nice to have, and as you can see I also use the opacity to change the background colour without effecting widget.

I then created an actor, lets call it BP_ArmHud. I import the armhud mesh and add it as a static mesh to the BP_ArmHud actor.

I first create the widget, and add that to a parameter and add it to the viewport. Then I create a dynamic material, here is where I set what “Effect Material” I should have in the retainer box. As you can see I get the widget, then the retainer box and use “Set Effect Material”. Then I set the static mesh (arm hud) material to the dynamic material I just created. Remember to set the correct index. As I explained earlier you need two in your static mesh.

That’s is, the last part is just the number updating trough a timer. So that it counts in the widget.

The rest is animations I have made in Blender of the arm moving up and down and then I just attached the BP_Armhud to the arm of the player skeletonmesh.