Preventing a player from moving via cinematic mode

Now that we know how to create Matinees, we should be able to create amazing cinematics that make your levels really come alive! However, by default, when you play a cinematic, the player can still move around and turn. This may be the desired behavior depending on whether you're using something like a custom camera system, such as Resident Evil, or the Matinee for moving objects such as moving platforms. But, for a cinematic, we don't want it. Thankfully, there is a way to prevent this via Blueprints.

Getting ready

Before we start working, you should have a level opened and have a complete Matinee. You should also have it playing in the actual game. For assistance with this, check out the Playing a Matinee via Blueprints recipe.

How to do it…

  1. Open up the level blueprint by going from the top tool bar and navigating to Blueprints | Open Level Blueprint.
  2. From here, we should have the appropriate nodes to play our Matinee.
  3. To the right of the Play node, right click and type in Cinematic in the search bar. At the bottom, you'll see the Game | Cinematic | Set Cinematic Mode option. Select it to create its node and drag it so that the arrows are alongside each other.

    The Set Cinematic Mode option enables us to remove the game's HUD, hide the player, and prevent movement and turning in the game. Of course, depending on the situation, you may want to use some or none of these options so that they're able to be customized from the node.

  4. Connect the output of the Play node to the input of the Set Cinematic Mode option. Toggle the Cinematic Mode option to turn on the cinematic mode. Uncheck Hide Player so that we can still see the player. Then, check Affects Movement and Affects Tuning; this will prevent the player from moving or using the mouse to move around while the cutscene is playing.
    How to do it…

    If you were to play the game now, you would notice that it works…maybe a little too well.

    How to do it…

That's because after we enabled cinematic mode, we never disabled it. Let's do this next.

  1. To fix this, we will need to have an event whenever the Matinee ends. Select your MatineeActor in the Scene Outliner tab and then go back into your level blueprint.
  2. From here, right-click and select Create a Matinee Controller for MatineeActor. You'll notice that it gives us a new node that contains a new Finished output that will be activated whenever the matinee will end.
  3. Next, create another Set Cinematic Mode action and uncheck Cinematic Mode and Hide Player while checking the other three properties below.
  4. Finally, connect the Finished output to the input of the Set Cinematic Mode node.
    How to do it…
  5. At this point, if we go in and play the game, the player will not move during the cinematic, but as soon as it's over, it can!
    How to do it…

    The final view after adding cinematic

Tip

To do this in another way, you can also use a Delay action and then set it to another cinematic mode or even use Boolean values, once you've got more experience in scripting to toggle their properties.

See also

There is an amazing amount of things that you can do within the Matinee editor. Sadly, I don't have the space in the book to write about everything, but I do have some links that, if you would like to know more, about some of the many other things you can do:

..................Content has been hidden....................

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