Gyroscopic Controls in Unity3D | Ian Trowbridge | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Gyroscopic Controls in Unity3D

teacher avatar Ian Trowbridge, Programming is my life

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

5 Lessons (10m)
    • 1. Prerequisites (Unity3D)

    • 2. Introduction (Unity3D)

    • 3. Setting It Up (Unity3D)

    • 4. Coding It Out (Unity3D)

    • 5. Show It Off (Unity3D)

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

This class is a tutorial over how to use gyroscopic controls in your projects that are constructed in Unity3D. I will show you how to create the scene, and code the controls. Finally, I will show you the game running on my phone (Samsung Galaxy S9), and how the gyroscopic controls work on a device.


Meet Your Teacher

Teacher Profile Image

Ian Trowbridge

Programming is my life


I am the lead programmer for games made by ShadowArk Studios, looking to teach other capable minds how to program.

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Prerequisites (Unity3D): All right. Hello, everyone. So this video, uh, serious is going to teach you gyroscopic controls using unity three D Now, Teoh, do that toe. Learn that. I mean, you have to obviously have unity three d installed. So you just go have been unity three d dot com I'll take you. You page here. Once you get here, you'll go to products and then latest release, and then you'll select whatever the latest version is. The latest right now is 2019.2. Uh, you'll hit, download now and old download an installer, uh, that you can use to set up the unity hub and then download the latest version of unity when you have that continue on and you will be able Teoh to learn how to program in Unity three . Now, one other thing is that when you install that, you will want to install the add ons for the android and the IOS compatibility so you can make those kind of games because that's what gyroscopic controls are generally used on. Um, now, in order to use the the android, um, in order to use Android publishing, then you have to get, uh, the android sdk. And to get that, you have to go to Android Tools. So, uh, in order to get that, you have to go the Android studio Does this type in android studio could be developer died and drawing that com slash studio and then hit Download Android studio. And then it'll download the sdk, and you'll have all the tools in order to build correctly. All right, please enjoy the Siri's. 2. Introduction (Unity3D): Hello, everyone. Welcome to this tutorial over gyroscopic controls. Immunity three D. Now, Scott, the control is a way for one to tilt the device in order to move an object and with the player giving it a simple till to move fun effect. This means that these controls are very nice for usage on things such as mobile phones on and, uh, tablets on android or I devices. Now, these controls are not commonly used on set devices in. The reason for that, I think, anyways, is because there are hardly any tutorials over how to do this. And when I tried teaching myself, it was beyond heart. So this project is meant to show you how to use gyroscopic controls in your projects. 3. Setting It Up (Unity3D): Alright, guys. So the first thing that you're gonna want to dio eyes were gonna want to open up unity three D and create a new three D project. All right, now, when that's done, don't even worry about it right now about saving a scene naming it. And you really want to this suggest construction and learning purposes. So in the scene, you will go to three D object and you will create a plane. Doesn't have to be super big. It could just be the standard size on scale. Now we will. Oh, that's great texture for that. So that we can see you know, the difference in the player and everything. All right, so just call it floor and change the help Meadow. Our power This pronounced to ah, color of your choice. I think gay and I start blue. I do. Yeah. All right. We're gonna put that in now. We're going to create another three d object, and we are going to create a sphere simply because a serious easier to control with the gyroscopic controls. So we're gonna change the position 2.5 so that it, uh, light access that it sits. Uh, just above before. Um and then we'll change where it sits on the map sits on middle. Change it, Teoh. Negative, for we'll do normal for normal four. So it's in this corner, all right. And that is how we will be setting up the scene. Girl Quickly. Will do is we will create a C sharp script name of player control if I could, and that is all for setting up the basics. 4. Coding It Out (Unity3D): All right. So now that we have the basic set up there, too, things that we need to do, one of which is very important and that I forgot to do, uh So first, let's go to our sphere, which is our players. So we'll just name it, player. That's number one on. And we need to add a component under the physics category called Rigid Body, which allows the three D object to move. Now it's all we had to dio. I know it sounded like I messed up completely in big time, but really simple just needed to do that. Now, what we need to do is open up the player control script, which hopefully we'll open up in visual studio for you guys. Um, it takes him in itself. Sorry for the delay. It's all right. So now that it's opened, what we need to dio we don't need that. Um though we need first create a couple of, uh what are they? A couple of variables? Thank you. No. The first variable that we need to do is, uh we need to create a variable for the rigid body. All right, so it was a private rigid, honey, we'll call it our Be all right now, we also need to create a public floats. And the reason this public is because this needs to be edible inside the editor. So as a public float speed on, we'll set that equal to three in here. They change it as needed in your project. So then we'll go to the start function and we'll type RB rigid body, uh, equals get component rigid body and put in your current disease and clothes off the line. And instead of updated comm, people call this fixed up. We don't need that green. Now, in the fix update will put Vector three axe ecstatic. However you feel like counting it, it will equal input acceleration. All right, now that will allow us to make this culture origen body so well, there are b AdForce a, c C x will call it acts for now. So along the x axis, a speed of speed. I you, uh, zero. So that doesn't move on the y axis because we don't want it is flying up in the air as we tilt the device. Unless you do. In which case, zero is where you that it that I acts dot Why or those that access? Uh, really confusing. But it has to be, uh, why so extra? Why, uh, times. And then again, speed Times two. All right. And then close off that line. And this is literally how simple it is to make a, um, a gyroscopic. They're controlled player control script. All you need are these lines here. So what we'll do is we'll go back in the unity. I will make sure that the player control script over here looks good. Matches up will go to player, will drag the player control script onto the player, and you can again change of speed. And here I'm gonna leave mine at three. Now, you will not see this Hilton and moving unless you have a tablet computer. Um, been even then, I'm not positive what you'd have to do switch this to an android or ah, Iowa's ah, project and then build it and put it on the device. And it will run just fine. And in the next part of this Siri's, I will actually show you it running on my phone 5. Show It Off (Unity3D): All right, So now I'm gonna show you how this looks in my game. This is just me tilting the device.