- Unity 3d how to#
- Unity 3d software#
- Unity 3d code#
Type in “FPSMovement” (don’t use any spaces otherwise you’ll get error messages)Ĭomponent called “FPSMovement” will now be attached to “FPS Character” and script with the same name will show up in Assets folder as any other asset would.Unity looks at our scripts as a custom components so to create new script we need to:
Now that we’ve set up our character we need to make it move when we use WASD keys. Now, if you go to Scene view and select “FPS Character” it should look like this: “FPS Character” is all set up Programming FPS movement
Set “Main Camera” position values to: X = 0, Y = 1.75, Z = 0. “Main Camera” is child object of “FPS Character” Drag “Main Camera” game object over “FPS Character” (“FPS Character” should be its parent object). Select “Main Camera” game object in Hierarchy window. To achieve so let’s put the camera where our characters eyes would be. Obviously, when playing an FPS game player should see the game from first person. Also, set “Height” property of that Capsule collider to be 2. Set Capsule collider “Center” properties to be the following: X = 0, Y = 1, Z = 0. Search for “Capsule Collider” and pick the first result. Next step is to set up collider for this character so that Unity knows how big our character is and when it should collide with other objects. So, for example, when character collides with the wall he’ll continue standing instead of falling down. This last step ensures that when outside forces affect our character he won’t rotate weirdly. Check X & Z for “Freeze Rotation” to be true. Click the arrow next to “Constraint” option on “Rigidbody” component. Type in “Rigidbody” and select first result. Next up let’s turn this FPS character into a physics object so that gravity affects it and it can interact with other physics objects in the scene. Select newly created game object currently simply named “GameObject”. For simplicity sake we’ll use only cubes and planes in this tutorial. In this section we’ll go over setting up a basic FPS character. Alternately, you can go to File -> Save for the same result. Do so by pressing Ctrl + S (for Windows) or Cmd + S (for Mac). Note: I’m using Unity 2019.3.9f1 but this tutorial should work for any other version as well.Īlso, as a good practice, you should save your Unity scene each time you make any changes to it. Select the destination for your project. Give your project a name (“Unity FPS Tutorial” in my case, but you can name it however you want). Unity 3d code#
Visual Studio or VS Code or any other text editor that works with Unity (Visual Studio will automatically be installed with Unity if you keep the default settings). Unity 3d software#
To get basic understanding of Unity check out their official Roll-a-ball tutorial (it’s very quick and easy to follow)Īlso, you’ll need the following software installed on your computer to be able to follow along:. To learn basics of C# check out this video by Code Monkey. In this course you’ll master the foundations of game development by exploring Unity engine & the C# programming language. Check out “ Intro to Game Development with Unity” course on Zenva Academy ( ). If you’re total beginner and want to learn basics of Unity and programming here are some helpful resources for you as well: Basic level of understanding of Unity (knowing what are scenes, game objects, components, inspector etc.). Unity 3d how to#
Basic knowledge of how to code (variables, if/else statements, loops, methods). Prerequisitesįirst of all, here’s everything you need to know to go through this tutorial successfully: The decision is yours, and whether or not you decide to buy something is completely up to you. Keep in mind that I link these companies and their products because of their quality and not because of the commission I receive from your purchases. Although, I do expect you to have at least some basic knowledge of how the Unity works and basic understanding of programming.Īll scripts I made for this tutorial will be available in the Outro section.ĭisclosure: Bear in mind that some of the links in this post are affiliate links and if you go through them to make a purchase I will earn a commission. This tutorial is beginner friendly and I’ll go over everything step-by-step. Every section of this tutorial will include all the code you need for each functionality to work properly. In this tutorial I’ll show you how to make a simple FPS character movement with Unity 3D.