1. Required Asset Setup

On this page, we will do a little bit of prep-work and set up the assets we will need to use later in this guide. We will create a destroyable Static Mesh, place down some spawn locations, and create a basic HUD to display information to the player about the state of the game.

For this guide, we have created a new project based off the Blueprint First Person template with Starter Content enabled. If you are unsure of how to create a project based off a template or how to enable Starter Content, please see the Project Browser documentation for information on setting up a project.

With your project created and open, press Ctrl+N to create a New Level and choose Default when prompted at the pop-up window. Once you have a fresh level created, follow the sections below to begin setting up each of the required assets.

Create a Destructible Static Mesh

Let us first create our shootable rock that will be destroyed when we hit it.

  1. In the Content Browser, open the Content/StarterContent/Props folder.

  2. In the Props folder, Right-click on the SM_Rock and choose Create Destructible Mesh.

    CreateMesh.png

  3. Open the SM_Rock_DM asset, then click the Fracture Mesh button from the toolbar.

    FractureMesh.png

    If you do not see the rock in the preview window, close the window and re-open it.

  4. Save and close the SM_Rock_DM asset.

  5. Right-click on the SM_Rock_DM asset then choose Asset Actions/Create Blueprint Using This....

    CreateBlueprint.png

    When prompted, give the Blueprint a name such as BP_Rock.

  6. When the Blueprint opens, click the Add Component button, then add a Projectile Movement component.

    AddProjectile.png

  7. Click the Projectile Movement component, then in the Details set the Initial Speed, Max Speed, and Velocity for X to 1500.00.

    ProjectileDetails.png

  8. Select the Destructible component, then in the Details panel under Collision check the Simulation Generates Hit Events option.

    GenerateHits.png

  9. Click the Compile and Save buttons, then close the Blueprint.

Place Spawn Points

We will now create some spawn points in our level to launch the shootable rock from.

  1. From the Modes menu, search for and add the Target Point to the level.

    AddTargetPoint.png

  2. Select the TargetPoint in the level, and set its Transform as shown below.

    TargetPointTransform.png

    Location for X is 7.0m, 0.0m, 0.0m and Rotation is 0.0, 40.0, 0.0.

    By entering 7.0m, it may convert the value to 700cm which is the equivalent value. Check out the World Scale section on the VR Best Practies page as it gives a breakdown of how Unreal Units are calculated as well as how to change the way measurements are displayed.

  3. In the level, with the Target Point selected, press Ctrl+W to duplicate it and set its Details as shown below.

    Duplicate1.png

    This will move the spawn point to the left of the first spawn point.

  4. Press Ctrl+W to duplicate the Target Point again and set the new Target Point's Details as shown below.

    NewDuplicate.png

  5. Select the PlayerStart in the level, then press E to enter Rotation mode and rotate it so it faces the Target Points.

    TargetPointsAdded.png

    You will now have three spawn points across from the Player Start (controller icon and direction indicated by the Blue Arrow).

Creating a HUD

The final piece of setup requires us to create a basic HUD to communicate information to.

  1. In an empty space in the Content Browser, Right-click and select User Interface/Widget Blueprint.

    CreateWidgetBlueprint.png

    A Widget Blueprint is a type of Blueprint used with Unreal Motion Graphics UI used to create HUD elements.

    See UMG UI Designer for more information.

  2. When prompted, call it HUD then open it up.

  3. In the Palette window under Panel, drag a Vertical Box onto the CanvasPanel in the Hierarchy window.

    AddVerticalBox.png

  4. Also under Panel, drag a Horizontal Box onto the Vertical Box in the Hierarchy window.

    AddHorizontalBox.png

  5. Under the Common section in the Palette, drag two Text widgets onto the Horizontal Box in the Hierarchy window.

    AddTextBlocks.png

  6. Select the Vertical Box in the Hierarchy window, then in the Details panel click Anchors and select the one shown below.

    AnchorSelected.png

    An Anchor will lock the UI element in the position specified regardless of screen size (see Anchors for more information).

  7. With the Vertical Box selected, move it over to the right-side of the screen and resize it so the text is displayed.

    MovedWidget.png

  8. Click on the left-most text displayed in the box, then in the Details panel under Text enter "Pulls:".

    EnterText1.png

  9. For the other text, enter the "10" for its Text field.

    EnterText2.png

    This text is what we will communicate with later and update based on the state of the game.

  10. In the Hierarchy window, Right-click and Copy the Horizontal Box, the paste it on top of the Vertical Box.

  11. Repeat the previous step so that there are now three Horizontal Boxes under Vertical Box and the text appears as shown below.

    AddedBoxes.png

  12. Update the other text fields to "Shots" (set to "3") and "Score" (set to "0") and click the Compile button.

    UpdateText.png

  13. Compile and Save then close the HUD Widget Blueprint.

Our assets are now set up. In the Next Step, we will make some minor changes to our Character Blueprint to make sure our playable character is set up correctly for our game.

Tags