Make Two Characters Move at Once

This beginner friendly tutorial is about how to make two (or more) characters in Unreal Engine 4 move at the same time.

  1. Create a new Third Person Template project.2characterbp
  2. You will need to create another character actor blueprints. Call it OtherCharacter. The parent for that class is Character. In the image, MainCharacter is the ThirdPersonCharacter blueprint.attachedobj
  3. Create an array of OtherCharacters inside the ThirdPersonCharacter. I called mine AttachedObjects. Remember to click the grid next to the variable type to make it an array and click the eye icon to the right to make it editable when placed in the map. Creating an array will help in the future if we are making more than one character move along with the original ThirdPersonCharacter.
  4. Place the OtherCharacter into the map by dragging its blueprint onto the map.
  5. Select the ThirdPersonCharacter that is placed in the level and inside the details panel on the right of the editor, you should find a Default tab. Expand it and locate AttachedObjects. Add a new element to it. This element will be the OtherCharacter you placed in the level.
  6. Now it is time for the movement code. Inside the OtherCharacter blueprint, make four Custom Events and name them JumpPressed, JumpReleased, MoveForwards, and MoveRight. The ThirdPersonCharacter is going to call these events to handle input.
  7. Add two inputs, Direction (Vector) and Value (Float), to the MoveForwards and MoveRight custom event.
  8. Make a Jump node and connect it to JumpPressed, make a Stop Jumping node and connect it to JumpReleased, make two Add Movement Inputs and connect each of those to the MoveForwards and MoveRight custom events. Connect the Direction and Value inputs to the respective Add Movement Input nodes.othercharactermovement
  9. In the ThirdPersonCharacter blueprint, we will call these four custom events to make all of the OtherCharacters move.maincharacterjumpmaincharactermovement
  10. Be sure to make Orientate Rotation to Movement true in Character Movement Rotation settings for the OtherCharacter. This will make the OtherCharacter look in the direction it is walking in.

There you go! You can make multiple OtherCharacters move at once by adding all of them to the AttachedObjects array in the ThirdPersonCharacter placed in the level. Be sure to also place the extra OtherCharacters in the level!

Thanks for reading!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s