Blueprint Quickshot: Adding 3D Widgets | 10 | v4.7 Tutorial Series | Unreal Engine

Blueprint Quickshot: Adding 3D Widgets | 10 | v4.7 Tutorial Series | Unreal Engine

♪♪♪ Wes Bunn: Hello again everyone, and welcome.
In this video, we are going to take a look at how we can expose variables inside of our Blueprints as 3D widgets that we can then use, modify, and manipulate inside of our viewport. Let’s get started. We are using the Blueprint First
Person Template project With Starter Content enabled. Let’s create a brand new Blueprint. In the Modes panel, go to the Basic tab
and drag an Empty Actor into the scene. In the Details panel, click the +Add Component button. Type and select, “Scene Component”. A Scene Component will allow us
to manipulate the Transform. I am going to call this component, “Root”. Click the +Add Component button.
Type and select, “Static Mesh”. That name is fine. In the Details panel under Static Mesh, click the None
drop down, type “cube” and select Shape_Cube. We will use a Shape_Cube
for this particular Blueprint we will create. Let’s create a Blueprint out of Shape_Cube actually. Click the Blueprint/Add Script button. Call this Blueprint the “Cube_Blueprint”.
Click Create Blueprint. Looks good to me. UE4 created a brand new Cube_Blueprint
in the Content Browser and opened a new tab for me. Select the Cube_Blueprint tab. There is our Static Mesh Component inside the Viewport. Go to the Event Graph. I am going to Right-click + drag
these defaults nodes out of the way. The first thing that we are going to do is create a brand new variable. Go to the My Blueprint panel and
click the +Add Variable button. Name this the “Sizer” variable. In the Details panel, click the Variable Type drop down menu and select a Vector. Check the Editable checkbox. Click Compile and go to the level.
If you recall, making a variable publicly editable will allow you to see that variable
and change it inside the Details panel. Which is cool, but there is one neat little trick.
Go back to the Cube_Blueprint, Check the Show 3D Widget checkbox. Click Compile, and go back to the level. Now you can see that we have a 3D representation of this variable inside of our level. How can we use this? You can see if we select it, first of all. [Laughing] If we select Cube_Blueprint, we can now move
it around in relation to our Blueprint’s location. It is able to move independently of our Blueprint. So how can we actually use this?
Let’s go ahead and find out. Go to the Cube_Blueprint again,
and go to the Construction Script. Hold Ctrl + drag Sizer into the graph. Drag off Sizer, type and select “Break Vector”. We are going to break this vector
into X, Y, and Z coordinates. We know that the size of our Cube is 100 units. Drag off Z, type and select, “Float / Float”. Set B of the Divide node to 100. Next, hold Ctrl + drag StaticMesh into the graph. Drag off Static Mesh, type and
select, “Set Relative Scale 3D”. Connect the Construction Script
to Set Relative Scale 3D. Drag off New Scale, type and select, “Make Vector”. Make Vector is going to give us X, Y, and Z.
Keep X and Y set to 1. Plug in Division node output to the Z because
we want to scale our box up and down. Click Compile and Save. You can see the
Construction Script has been fired because we compiled. Go back to the level and look
at our little cube. It is flattened out. But, there is our Sizer there. Let’s move it back. Actually,
moving it back is not going to matter because we didn’t adjust the X and Y.
[Laughing] Now we can move our cube and resize it
in the viewport because we adjusted the Z. How can we use this to our advantage? If we wanted to create some kind of
procedural content like a fence for example, we could have a fence spawn at each of the locations
of our 3D widgets to procedurally create a fence. Or, there are several other things you could do.
You can kind of experiment to see what works best for you. But, that is how you expose variables and
expose the 3D widget inside Blueprints. I hope you all enjoyed this video.
We will see you next time. ♪♪♪

4 thoughts on “Blueprint Quickshot: Adding 3D Widgets | 10 | v4.7 Tutorial Series | Unreal Engine”

  1. Hey this was really awesome, but calling this video how to use a 3d widget was a bit misleading. A more accurate title would be something like 'how to scale objects using a 3d widget'. On one hand, that is totally something I would want to know, and have been wondering if was possible for a long time. On the other hand, this video is how to make a 3d widget, in the way that most people mean when they say '3d widget'.

Leave a Reply

Your email address will not be published. Required fields are marked *