1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ROLL-A-BALL TUTORIAL #2

Posted at

Creating stage

At first, we must create materials for the composing stage.
Ex. ground and walls and so on.

1. Creating groud

At first, we create the ground. See below for creating "Game Object" to have function "Panel" in this "Scene".

  1. Click "Create" in "Hierarchy"
  2. Select "Panel" in "3D Object".
    図1.png

About "GameObject ・・・ "In “Unity”, we call all putting materials in “Scene” by “Game Object”. “Game Object” is appeared 3D meshes, lights (stage lighting), physical objects, transparent sounds, and triggers. Unity manages all materials, assigns and controls scripts optionally.

2. Setting ground

We adjust the ground to size. There are two options. Option 1 is setting Panels. Option 2 is stretching. Today choose a setting, it’s no reason.

  1. Select “Panel” in the “Hierarchy” view, and select the right-click and “Duplicate”.
  2. Select the newly created “Panel” position, and change the “Move Object” mode in control mode at the left top panel.
  3. Adjust a “Panel” position by operating an appeared arrow.
    図2.png

We will make ground by 4 “Panel”s.
Then, we should change “Panel” names. We change “Panel” names to “Ground1”, “Ground2”, “Ground3”, and “Ground4” as the object names. We can change object name at the name in the top of Inspector View
図3.png

3. Adjusting position

At last, we should adjust the position numerally. When adjusting the position, we would find that change selection and each time change the parameter in the inspector view on the right of the editor.
This inspector view shows a component detail to compose Game Object is selected. There are components as “icon”, “checkbox for enabling or disable”, “component name”, “option” from the left side to the right side. There is “help” on the left side of “option”, and we can see help documents.

4. Setting up 4 Panels

Actually. We will adjust coordinates. The transform component manages coordinates. “Position” manage coordinates of the object, “Rotation” manage spin of an object, and “Scale” manage the size of the object. Today, we adjust the position, see below.
図4.png

● Ground1(x:5, y:0, z:-5),
● Ground2(x:5, y:0, z:5),
● Ground3(x:-5, y:0, z:-5),
● Ground4(x:-5, y:0, z:5)
図5.png

5. Painting ground color

We will set the color on the floor.
2 ways set the color on “Model”. 1st way is setting texture, and 2nd way is setting the color of all models. “Material” file manage material of these color and reflection.

  1. Click the “Create” button on Project Browser.
  2. Select “Material” in the list.
  3. Change the name to “GroundMaterial”.
    図6.png

5-1. Setting color at “Material”

Next, we set the color at “Material”.

  1. Select “GroundMaterial” that created before this.
  2. Select “O” of the left side, and select “Default Checker”.
    図7.png

5-2. Setting “Material” on “Ground”

Next, we will paint color on Ground that used Material detail.

  1. Drag & drop “Ground” on Ground(1-4) in Hierarchy view

6. Creating a wall

We will make a stage that have 4 walls all around. There are walls all around, function to the ball cannot go outside.
Then, shall we create walls?

  1. Click the “Create” button in the “Hierarchy” view.
  2. Create “Cube” from “3D Object > Cube”.
  3. Rename created “Cure” to “Wall”.
    図8.png

6-1 . Setting wall color

We will change the wall color.

  1. Click the “Create” button in the “Project” browser.
  2. Select “Material”.
  3. Rename “WallMaterial”.
  4. Select “WallMaterial” and set “albedo” to color like red.
  5. Drag & drop “WallMaterial” onto the “Wall” object.
    図9.png

6-2. Putting wall

Next, Use a way of stretch, to change wall size to create.
When stretching, select the scale model from the top left panel, and select the object, and drag the block in the direction you want to stretch.
Next, select the created Cube in Move mode, and hold down “V” to move. By moving while holding down V, it moves as to suck at the apex of another model, so you can easily adjust it.
We adjust to the inspector's view of completeness. “Panel” size corresponds to “Cube”'s 10x10, so change the below size.
Position(x:-0.5, 0.5, -9.5)
Scale(x:19, y:1, z:1)
図10.png

Put on the opposite. Duplicate the created “Cube”, and put on the opposite.
Position(x:0.5, 0.5, 9.5)
Scale(x:19, y:1, z:1)
図11.png

6-3. Rotating object

We have two ideas to put the walls on both sides. 1st idea is to "stretched Cube stick" by “rotate 90 degrees”. 2nd idea is creating a stick that stretches to a different direction ((x: 1, y: 1, z: 19).
We can use the way “rotate 90 degrees”. Because explain the way of rotation.
To rotate, select rotation mode, and drag the displayed outer frame. Operating while pressing Ctrl (Command) and so rotates by 45 degrees each time.
But set on Inspector view. First, duplicate one of the “Cube” and create “Cube 3”. Next, set below for “Cube3”’s rotation.
Position(x:-9.5, y:0.5, z:0.5)
Rotation(x:0, y:90, z:0)
図12.png

Duplicate “Cube3”, and create “Cube4”. Adjust the following position.
Position(x:9.5, y:0.5, z:-0.5)
図13.png

7. Rearrange object

It becomes troublesome to clutter an object and a scene in the project. So, we use an empty object and organize the objects.

7-1. Setting Material

Make a “Material” folder for a Materials list, and save it in this folder.

  1. Click “Create” on the Project browser.
  2. Select Folder.
  3. Change the Folder name to "Material".
  4. Select "GroundMaterial" and "WallMaterial". Drag & drop to the "Material" folder.

7-2. Create a blank "Stage" object

Next, sort out objects in the "Hierarchy" view. Create a blank "Stage" object.

  1. Click the "Create" button in the "Hierarchy" view.
  2. Select "Create empty".
  3. Change object name to "Stage".
  4. Select the list of “Wall” and “Ground” last step created in the “Hierarchy” view. Drag & drop to “Stage” object.
    図14.png

7-3. Putting on “Stage” as a static object

In the last step, the stage object is not a dynamic object, then putting the static object. Because performance and visual will be improved.

  1. Select the "Stage" object in "Hierarchy" view.
  2. Check the "Static" button on the "Stage" object in the "Inspector" view.
  3. Show "Do you want to enable the static flags for all the child objects as well?" and we select "Yes Change Children".

図15.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?