Challenge 1 - Plane Programming
Tutorial
Beginner
30 Mins
Overview
For Educators
Summary
Challenge Overview:
Use the skills you learned in the driving simulation to fly a plane around obstacles in the sky. You will have to get the user’s input from the up and down arrows in order to control the plane’s pitch up and down. You will also have to make the camera follow alongside the plane so you can keep it in view.
Challenge Outcome:
  • The plane moves forward at a constant rate
  • The up/down arrows tilt the nose of the plane up and down
  • The camera follows along beside the plane as it flies
Language
English
Recommended Unity Versions
2018.4 and Above
Tutorial
Challenge 1 - Plane Programming
1.
Introduction to Challenges

2.
Challenge 1 Overview

  • Open your Prototype 1 project
  • Download the "Challenge 1 Starter Files" from the Tutorial Materials section, then double-click on it to Import
  • In the Project Window > Assets > Challenge 1 > Instructions folder, use the "Challenge 1 - Instructions" and Outcome video as a guide to complete the challenge

3.
The plane is going backward
  • Make the plane go forward
Hint: Vector3.back makes an object move backwards, Vector3.forward makes it go forwards

4.
The plane is going too fast
  • Slow the plane down to a manageable speed
Hint: If you multiply a value by Time.deltaTime, it will change it from 1x/frame to 1x/second

5.
The plane is tilting automatically
  • Make the plane tilt only if the user presses the up/down arrows
Hint: In PlaneController.cs, in Update(), the verticalInput value is assigned, but it’s never actually used in the Rotate() call

6.
The camera is in front of the plane
  • Reposition it so it’s beside the plane
Hint: For the camera’s position, try X=0, Y=30, Z=10 and for the camera’s rotation, try X=90, Y=0, Z=0

7.
The camera is not following the plane
  • Make the camera follow the plane
Hint: In FollowPlane.cs, neither the plane nor offset variables are assigned a value - assign the plane variable in the camera’s inspector and assign the offset = new Vector3(0, 30, 10) in the code

8.
Bonus: The plane’s propeller does not spin
  • Create a script that spins the plane’s propeller
Hint: There is a “Propeller” child object of the plane - you should create a new “SpinPropellerX.cs” script and make it rotate every frame around the Z axis.