Readying direction for calculations

Now, let's explore the steps necessary to get the information we need to provide a movement instruction. It might look intimidating at first, but we will break down each section and see how each node fits into the larger goal.

The first calculation we need to perform is to take our vector value for direction and normalize it. Normalizing is a common procedure in vector math that ensures that the vector is converted to a length of one unit, which makes it compatible with the rest of our calculations. Fortunately, there is a Blueprint node that takes care of this for us.

Click on the Direction variable we created in the My Blueprint panel, and drag it to an empty space in Event Graph. A small popup appears, prompting you to select GET or SET. We want to retrieve the value we set for the direction, so let's choose GET to create a node containing the Direction variable's value. Click on the output pin of the Direction node, and drop it in empty graph space. Type normalize in the search field and select the Normalize node underneath the category-labeled vector. This connects your Direction variable to a node that automatically does the normalizing calculation for us:

It is good practice to leave comments on the sets of Blueprints as you create them. Comments can help describe what a particular set of Blueprints is intended to accomplish, which can be helpful if you are returning to a Blueprint after some time and need to make sense of your prior work. To leave a comment on a Blueprint, click and drag a selection box around the nodes you want to create a comment around, in order to select them. Then, right-click on one of the selected nodes and select the bottom option, Create Comment from Selection.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset