Detecting a hit

To create our hit detection Event, right-click on empty graph space and type hit in the search box. The Event Hit node is what we are looking for, so select it when it appears in the search results. Event Hit triggers Actions every time another Actor hits the Actor controlled by this Blueprint:

Once you have the Event Hit node on the graph, notice that Event Hit has a number of multicolored output pins originating from it. The first thing to notice is the white triangular pin that is in the top-right corner of the node. This is the execution pin, which determines the next Action to be taken in a sequence. Linking the execution pins of different nodes together is how we enables basic functionality in all Blueprints. Now that we have the trigger, we need to find an Action that will enable us to change the Material of an Actor. Click and drag a wire from the execution pin to an empty space on the right of the node.

Dropping a wire into empty space like this generates a search window, which allows you to create a node and attach it to the pin you are dragging from in a single operation. In the search window that appears, make sure that the Context Sensitive box is checked. This limits the results in the search window to only those nodes that can actually be attached to the pin you dragged to generate the search window. With Context Sensitive checked, type set material in the search box. The node we want to select is called Set Material (StaticMeshComponent):

If you cannot find the node you are searching for in the Context Sensitive search, try unchecking Context Sensitive to find it from the complete list of node options. Even if the node is not found in the Context Sensitive search, there is still a possibility that the node can be used in conjunction with the node you are attempting to attach it to.
..................Content has been hidden....................

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