A blog about VFX, scripting, van renovation, and some other gubbins.

@henloco

Triggering events between actors in Unreal Engine

Published 23rd January 2020 by Henry

This is useful for, for example, triggering different weather conditions. In this example I’ll add different types of snow.

  1. Add a list of options to choose from – Create an ENUM structure (Blueprint > Enum), call it ENUM_RainTypes and add some options such as None, Light, Heavy
  2. Make a trigger blueprint that can be reused throughout the level – Create an Actor Blueprint and name it BP_RainTrigger and add a trigger box. Set it as the root component.
  3. Get the player pawn – In the BP_RainTrigger Event Graph, use the BeginPlay event to exec a Cast to on your player pawn. Use Get Player Pawn node to get the current player pawn and set the pawn to a variable for use later.
  4. Setup the overlap trigger event – In BP_RainTrigger Event Graph still, use the ActorBeginOverlap event to exec a Switch on ENUM_RainTypes. Add a variable of type ENUM_RainTypes (this will allow users to select the rain type for each BP_RainTrigger instance in the level). Plug this into the ENUM_RainTypes Selection pin.
  5. You can now use the execution pins from the ENUM_RainTypes node to trigger events in the player pawn blueprint (these events will need to be setup separately).
  6. Plug in the player pawn variable we created before to access the event in the other blueprint. 

More

Previous

Fireplace Simulator in Unreal Engine

Next

Animating materials from blueprints without using timelines

Leave a Reply

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