Changing the Actor's Mobility and Collision settings

To allow our target to move, we first have to change the Actor's Mobility setting to Moveable. This allows an object to be manipulated while playing the game. From the main Editor view, select CylinderTarget_Blueprint, and look at the Details panel. Underneath the Transform values, you can see a toggle for Mobility. Change this from Static to Moveable, as shown in the following screenshot:

By default, basic Actors that are placed in the world are set to Static. Static means that the object cannot move or be manipulated during gameplay. Static objects are significantly less resource intensive to render, and this should be our default choice for non-interactive objects so that we can maximize frame rates.

It is important to note that the version of the target Cylinder that we changed in the Level is just one instance of the Blueprint template for the target Cylinder that we have created. An instance refers to an actual object that has been created, whereas our Blueprints are descriptions of the kinds of features that those instances will have once they are created.

Any changes we make to a target Cylinder that is already inside the Level is made for that particular target Cylinder only. To make changes to all future targets, we need to modify the Blueprint directly. To do so, open CylinderTarget_Blueprint again, either by navigating to the open tab in the Editor or by double-clicking on the CylinderTarget_Blueprint file in your Blueprints folder.

With the Blueprint open, we want to navigate to the Viewport tab that is located underneath the menu toolbar. Along the left side, you can see the Components panel, which lists all the Components that make up this Blueprint. Since we want to edit a property of the physical object, or Mesh, we click on StaticMeshComponent. We see a familiar-looking Details panel. It includes the same properties and categories that we saw when we edited the target Cylinder in the Level Editor. Here, we have to switch the same Mobility toggle, located underneath the Transform properties, from Static to Movable. This ensures that all future targets created from this Blueprint will already be set to be Moveable.

Because we want to target this object with our gun, we also need to ensure that the target is capable of being collided with so that our bullets don't pass through it. In the Details panel, find the category called Collision and look for Collision Presets in the drop-down menu. There are many other options in this drop-down, and by choosing the Custom option, you can even set the object's Collision interaction with different object types individually. For our purpose, we just need to ensure that this drop-down menu is set to BlockAllDynamic, which ensures that the Mesh registers collisions with any other object that also has a collider:

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

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