Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Based on Roll-a-ball video tutorial from Unity Technologies
Part 1
@shahedC
WakeUpAndCode.com
Getting Started
> Creating the Ground
> Creating the Player
> Materials, Colors & Lighting
> 3D Physics & Movement
Control...
Select 3D (not 2D) Click [Create project]
Click Layout
dropdown
to select
or save
Click
File 
Save Scene
Create
New folder
below
Assets
folder
Name it
“Scenes”
, then click [Save]… Name your scene “PlayingField.unity”
Inside
“Scenes”
Subfolder…
Verify
Saved Scene
in
Project panel
Verify Scene Name in Title Bar
Click GameObject  3D Object  Plane Click Create  3D Object  Plane
In the top menu… In the Hierarchy panel…- OR -
Right-click to rename
Enter “Ground”
Select
“Ground”
in Hierarchy
Click gear icon
next to
Transform
then
click “Reset”
With “Ground” selected in hierarchy…
… press ‘F’ on your keyboard to focus on it
… move your cursor to the Scene
Scroll the mouse wheel over your scene to zoom in/out
In the Scene panel, click the Gizmos dropdown to toggle “Show Grid”
Click on the Scale tool, while the Ground is selected…
… then, drag the handles to resize the ground
Manually enter Scale values in the Ground’s Transform component
Scale: X = 2, Y = 1, Z = 2
Click GameObject  3D Object  Sphere Click Create  3D Object  Sphere
In the top menu… In the Hierarchy panel…- OR -
Position Sphere at X = 0, Y = 0.5, Z = 0
In the Project panel,
click Create dropdown
then, select “Folder”
In Project panel,
click Create
then, select “Folder”
Rename it “Materials”
In Project panel,
click Create
then, select
“Material”
Rename it “GroundMaterial”
Repeat for “BallMaterial”
For each
material...
Update color
in Inspector
window
(click white
square)
• Red
• Green
• Blue
• Alpha (Transparency)
Verify that GroundMaterial and BallMaterial have different colors.
Drag each material from Project panel to the Scene panel
Update Direction Light in Inspector
Rotation: X = 50, Y = 60, Z = 0
With “Ball” selected in the Hierarchy panel…
Click Component  Physics  RigidBody
With “Ball” selected in the Hierarchy panel, click Add Component  Physics  Rigidbody
Verify RigidBody Component
In the Project panel,
click Create dropdown
Then select “Folder”, name it “Scripts”
In the Project panel,
click Create dropdown Then select “C# Script”, name it
PlayerController
With “Ball”
selected...
… Drag
script into
Ball
Verify Script
Component!
Add FixedUpdate() method
… just before last curly brace
Inside FixedUpdate() method…
Calculate 3D movement
Define rb
just before Start()
Initialize inside
Start() method
Add Force inside
FixedUpdate()
Click Play button, move around with arrow keys!
Define public
speed variable
Multiply speed
with movement
With “Ball”
selected...
Set Speed = 10
Click Play button, move around with arrow keys!
Set Camera Position and Rotation
• Position: X = 0, Y = 10, Z = -10
• Rotation: X = 45, Y = 0, Z = 0
Camera should
appear higher
with a better view
In the Project panel,
click Create dropdown Then select “C# Script”, name it
CameraController
Define instance
variables
just before Start()
Initialize offset
in Start() method
Add
LateUpdate()
method
Then, set
camera
position
With
“Main Camera”
selected...
… Drag
script into
camera
Verify Script
Component!
With
“Main
Camera”
selected...
… Drag Ball into Camera’s Player object
Click Play, move around!
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Rollerball: 1 of 2
Upcoming SlideShare
Loading in …5
×

Rollerball: 1 of 2

6,618 views

Published on

* Blog post: http://wakeupandcode.com/rollerball-unity-3d-tutorial
* Rollerball 1 of 2, a Unity 5 tutorial based on Roll-a-ball tutorial from Unity Technologies.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Rollerball: 1 of 2

  1. 1. Based on Roll-a-ball video tutorial from Unity Technologies Part 1 @shahedC WakeUpAndCode.com
  2. 2. Getting Started > Creating the Ground > Creating the Player > Materials, Colors & Lighting > 3D Physics & Movement Controlling the Camera
  3. 3. Select 3D (not 2D) Click [Create project]
  4. 4. Click Layout dropdown to select or save
  5. 5. Click File  Save Scene
  6. 6. Create New folder below Assets folder Name it “Scenes”
  7. 7. , then click [Save]… Name your scene “PlayingField.unity” Inside “Scenes” Subfolder…
  8. 8. Verify Saved Scene in Project panel Verify Scene Name in Title Bar
  9. 9. Click GameObject  3D Object  Plane Click Create  3D Object  Plane In the top menu… In the Hierarchy panel…- OR -
  10. 10. Right-click to rename Enter “Ground”
  11. 11. Select “Ground” in Hierarchy Click gear icon next to Transform then click “Reset”
  12. 12. With “Ground” selected in hierarchy… … press ‘F’ on your keyboard to focus on it … move your cursor to the Scene
  13. 13. Scroll the mouse wheel over your scene to zoom in/out
  14. 14. In the Scene panel, click the Gizmos dropdown to toggle “Show Grid”
  15. 15. Click on the Scale tool, while the Ground is selected… … then, drag the handles to resize the ground
  16. 16. Manually enter Scale values in the Ground’s Transform component Scale: X = 2, Y = 1, Z = 2
  17. 17. Click GameObject  3D Object  Sphere Click Create  3D Object  Sphere In the top menu… In the Hierarchy panel…- OR -
  18. 18. Position Sphere at X = 0, Y = 0.5, Z = 0
  19. 19. In the Project panel, click Create dropdown then, select “Folder”
  20. 20. In Project panel, click Create then, select “Folder” Rename it “Materials”
  21. 21. In Project panel, click Create then, select “Material” Rename it “GroundMaterial” Repeat for “BallMaterial”
  22. 22. For each material... Update color in Inspector window (click white square)
  23. 23. • Red • Green • Blue • Alpha (Transparency)
  24. 24. Verify that GroundMaterial and BallMaterial have different colors.
  25. 25. Drag each material from Project panel to the Scene panel
  26. 26. Update Direction Light in Inspector Rotation: X = 50, Y = 60, Z = 0
  27. 27. With “Ball” selected in the Hierarchy panel… Click Component  Physics  RigidBody
  28. 28. With “Ball” selected in the Hierarchy panel, click Add Component  Physics  Rigidbody
  29. 29. Verify RigidBody Component
  30. 30. In the Project panel, click Create dropdown Then select “Folder”, name it “Scripts”
  31. 31. In the Project panel, click Create dropdown Then select “C# Script”, name it PlayerController
  32. 32. With “Ball” selected... … Drag script into Ball Verify Script Component!
  33. 33. Add FixedUpdate() method … just before last curly brace
  34. 34. Inside FixedUpdate() method… Calculate 3D movement
  35. 35. Define rb just before Start() Initialize inside Start() method Add Force inside FixedUpdate()
  36. 36. Click Play button, move around with arrow keys!
  37. 37. Define public speed variable Multiply speed with movement
  38. 38. With “Ball” selected... Set Speed = 10
  39. 39. Click Play button, move around with arrow keys!
  40. 40. Set Camera Position and Rotation • Position: X = 0, Y = 10, Z = -10 • Rotation: X = 45, Y = 0, Z = 0
  41. 41. Camera should appear higher with a better view
  42. 42. In the Project panel, click Create dropdown Then select “C# Script”, name it CameraController
  43. 43. Define instance variables just before Start()
  44. 44. Initialize offset in Start() method
  45. 45. Add LateUpdate() method Then, set camera position
  46. 46. With “Main Camera” selected... … Drag script into camera Verify Script Component!
  47. 47. With “Main Camera” selected... … Drag Ball into Camera’s Player object
  48. 48. Click Play, move around!

×