Changing direction

If you were to compile the Blueprint, save, and play the game now, what would you expect to see? The target cylinder would move according to our speed and direction as soon as the game began. However, since we don't have any instructions that cause the target to stop moving, it would proceed in the same direction for as long as the game runs, even moving through objects and out of the level we created! To address this, we need logic that will change the target's direction periodically. This will result in a target that moves back and forth between two points regularly, much like a shooting gallery target.

To do this, we have to set up two nodes that will set the direction variable we created to two different values. Drag the ...

Get Blueprints Visual Scripting for Unreal Engine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.