Making an Acid Pool

Verificado com a versão: 2018.1

-

Dificuldade: Principiante

PolyBrush

The ground is made of a ProBuilder Plane. These are usually flat, but by using PolyBrush we can create an uneven surface and paint textures to make this Mesh resemble the ground. We’ll be making a dip in the ground where we can add in a pool of Acid as a hazard for Ellen.

Mesh: A mesh consists of triangles arranged in 3D space to create the impression of a solid object. A triangle is defined by its three corner points or vertices.

Note: PolyBrush is currently in Beta, so you may experience some bugs using this tool.

We can make this Plane a bit larger for the level we will be building by scaling it:

  • Select the Plane in the Hierarchy

  • Navigate to the Inspector

  • Set the Scale in the X Axis to 2

  • Keep the Scale of the Y Axis at 1

  • Set the Scale of the Z Axis to 2

Let’s open the PolyBrush Window and start editing:

  • Go to Tools > PolyBrush > PolyBush Window

Note: PolyBrush is currently in Beta, so the layout may change.

With the Plane selected;

  • Click on the Push/Pull icon in the PolyBrush Window

  • Select the Plane and then Hover over it in the Scene View

  • The Push/Pull gizmo will appear wherever you move your mouse.

  • Left click to raise the ground by pulling vertices up

  • Or Hold Ctrl and left click to lower the ground by pushing vertices down

Now you know the basics, create a small dip on your plane using Ctrl + Left Click to start forming a pool. This doesn’t need to be too deep.

  • Click on the Push/Pull icon again when you are done editing to deselect the tool.

You should have something similar to the following.

For more information on PolyBrush and how to use it, visit the Tutorials and Documentation

For now, let’s continue to make our first hazard.

Adding Acid

To find the Acid, we need to navigate to the Project window. This is where all the Prefabs and tools are stored:

  • Go to Assets > 3D GameKit > Prefabs > Interactables

  • Left-click and drag the Acid Prefab into the Hierarchy

The Acid will appear somewhere in your Scene. In Unity, you can locate an object quickly by Frame Selecting:

  • Select the Acid in the Hierarchy

  • Hover your mouse in the Scene view

  • Press F on the Keyboard

This will find and frame the Acid in the Scene view.

The Acid is currently too large, so let’s scale this down a little:

  • With the Acid selected, press R on the Keyboard for the Scale tool

  • Click and drag on the white box in the middle to make the Acid smaller

The Acid is also in the wrong position. Use the Move Tool (select the Acid and press W) to place the Acid just below the Plane, making it peek through slightly where you have made your pool.

You can continue to position and scale the Acid until you have the results you want.

Tip: The acid only needs to be just bigger than the space of your pool.

  • Press Play and test your Scene to check your bubbling Acid pool.

Note: When making a new Scene via the 3DGamekit toolbar menu, it will add a default DeathVolume area that is very large in size to allow you sufficient editing space. Be careful when lowering the terrain below this as Ellen will die on entry.

Top View - Default Level Death Volume

Side View - Default Level Death Volume

Adding a Death Volume

At the moment, Ellen can have a bath in the Acid and not get hurt, which doesn’t make it much of a hazard.

To make the Acid kill Ellen (sorry Ellen) when she steps into it:

  • Select the Acid in the Hierarchy

  • In the Inspector click Add Component

  • Type ‘death’ into the search box

  • Select the Death Volume script

This will add the Death Volume script to the Acid. This is a script we have made that instructs the game to cause Ellen to lose all her health.

  • Press Play and test your level. Try running into the pool of Acid, Ellen will die and respawn shortly after.