banner



What Camera Does Tyler1 Use

In this tutorial I'll bear witness you how to make a simple FPS character movement with Unity 3D. Every department of this tutorial will include all the code y'all need for each functionality to work properly. This tutorial is beginner friendly and I'll get over everything footstep-past-footstep. Although, I exercise wait you to take at to the lowest degree some basic knowledge of how the Unity works and basic agreement of programming.

All scripts I made for this tutorial volition be available in the Outro section.

Disclosure: Bear in heed that some of the links in this post are chapter links and if you go through them to make a purchase I volition earn a commission. Keep in mind that I link these companies and their products considering of their quality and non considering of the commission I receive from your purchases. The decision is yours, and whether or non you decide to buy something is completely upwards to you.

Prerequisites

First of all, here's everything you need to know to go through this tutorial successfully:

  • Basic knowledge of how to lawmaking (variables, if/else statements, loops, methods)
  • Basic level of understanding of Unity (knowing what are scenes, game objects, components, inspector etc.)

If you're total beginner and want to learn basics of Unity and programming hither are some helpful resources for you lot as well:

  • Check out "Intro to Game Development with Unity" course on Zenva Academy (https://university.zenva.com/production/intro-to-unity-game-development/?a=294&campaign=Unity-for-beginners). In this grade you'll main the foundations of game development by exploring Unity engine & the C# programming linguistic communication.
  • To learn basics of C# check out this video by Code Monkey
  • To get basic understanding of Unity bank check out their official Roll-a-brawl tutorial (it's very quick and easy to follow)

Besides, you'll demand the following software installed on your computer to be able to follow along:

  • Unity game engine (https://store.unity.com/#plans-individual)
  • 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)

Start new project in Unity

To outset new projection:

  • Open upward Unity
  • Click on "New"
  • Give your project a name ("Unity FPS Tutorial" in my case, but you tin name it however you want)
  • Select the destination for your project
  • Set template to 3D
  • Hit "Create"
Starting new project in Unity
Creating new project in Unity

Note: I'm using Unity 2019.3.9f1 only this tutorial should piece of work for whatsoever other version as well.

Besides, every bit a adept practise, you should save your Unity scene each fourth dimension you make whatsoever changes to it. Exercise then past pressing Ctrl + S (for Windows) or Cmd + Due south (for Mac). Alternately, you tin become to File -> Save for the same result.

Setting up FPS grapheme

In this department we'll go over setting up a bones FPS character. For simplicity sake we'll use only cubes and planes in this tutorial.

To create a character do the following:

  • Right click in the Hierarchy window
  • Pick "Create empty"
  • Select newly created game object currently simply named "GameObject"
  • Rename information technology to "FPS Character"
Rename "GameObject" to "FPS Character"
Rename "GameObject" to "FPS Graphic symbol"

Next up allow'southward turn this FPS character into a physics object so that gravity affects information technology and it can interact with other physics objects in the scene. We can do that similar this:

  • Select "FPS Character" game object
  • In the Inspector click "Add component"
  • Blazon in "Rigidbody" and select first upshot
  • Click the pointer side by side to "Constraint" option on "Rigidbody" component
  • Check X & Z for "Freeze Rotation" to be true
Set X and Z constraints on Rigidbody
Fix X and Z constraints on Rigidbody

This last step ensures that when outside forces affect our character he won't rotate weirdly. So, for example, when graphic symbol collides with the wall he'll proceed standing instead of falling down.

Next pace is to gear up collider for this character so that Unity knows how large our graphic symbol is and when it should collide with other objects.

  • Select "FPS Graphic symbol"
  • Click "Add component"
  • Search for "Sheathing Collider" and selection the starting time event
  • Gear up Capsule collider "Eye" backdrop to be the following: X = 0, Y = ane, Z = 0
  • Also, set "Meridian" property of that Capsule collider to be 2

Obviously, when playing an FPS game player should see the game from first person. To reach so allow's put the camera where our characters eyes would exist.

  • Select "Main Camera" game object in Hierarchy window
  • Drag "Main Camera" game object over "FPS Grapheme" ("FPS  Character" should exist its parent object)
"Main Camera" is child object of "FPS Character"
"Main Camera" is child object of "FPS Character"
  • Prepare "Master Photographic camera" position values to: X = 0, Y  = 1.75, Z = 0

Now, if you go to Scene view and select "FPS Character" it should look like this:

Setting up FPS character
"FPS Grapheme" is all gear up

Programming FPS motility

At present that we've prepare up our graphic symbol nosotros need to make it motion when nosotros use WASD keys. To exercise then we have to create a script. Unity looks at our scripts every bit a custom components so to create new script nosotros need to:

  • Select "FPS Character"
  • Click "Add Component"
  • Type in "FPSMovement" (don't use whatever spaces otherwise y'all'll get error messages)
  • Pick "New Script"
  • Click "Create and Add"

Component chosen "FPSMovement" will now be fastened to "FPS Grapheme" and script with the same proper noun will bear witness up in Avails folder as whatsoever other nugget would.

Now, open up the script (either double click on "FPS Movement" component or double click the script asset in Project window). It volition await similar this:

using Arrangement.Collections; using Organization.Collections.Generic; using UnityEngine;  public class FPSMovement : MonoBehaviour {     // Showtime is called before the first frame update     void Commencement()     {              }      // Update is called once per frame     void Update()     {              } }

To make our character motility we'll use Unity'southward physics system and to be able to do then we accept to first access "FPS Character"'s Rigidbody component. Modify yous script similar this:

Rigidbody rb;  void Beginning() {     rb = GetComponent<Rigidbody>(); }

This code needs to be inside "FPSMovement" class in order for it to work.

So rb is a variable of type "Rigidbody" and it allows us to access all other variables and methods that are within that grade.

Showtime method will be chosen once (when we outset the game) and in it nosotros'll use GetComponent<Rigidbody>() method to access Rigidbody component of the object this script is attached to. In our case it will return Rigidbody component of "FPS Grapheme" and we'll relieve the reference to that component in rb variable.

Side by side up, we need to know how fast our character is going to move. So permit's add another variable and phone call it speed. This line of code should also be inside the form. Expert practice is to proceed all variables at the peak so add this line of code merely bellow rb variable.

[SerializeField] float speed;

As you can run into speed variable is of "bladder" type, meaning information technology'southward a decimal number. We use "[SerializeField]" flag in front end of our variable because nosotros nonetheless want to keep this variable private to "FPSMovement" class but we want to exist able to access it inside Unity editor.

To perform the actual movement we have to add the post-obit lawmaking to our Update method:

void Update() {     bladder x = Input.GetAxisRaw("Horizontal");     bladder z = Input.GetAxisRaw("Vertical");      Vector3 moveBy = transform.correct * x + transform.forward * z;      rb.MovePosition(transform.position + moveBy.normalized * speed * Fourth dimension.deltaTime); }

Equally you can see, we start employ the method Input.GetAxisRaw("Horizontal"). This method returns the following values:

  • 1 if actor presses D or Right arrow key
  • -1 if player presses A or Left pointer cardinal
  • 0 if those keys are non pressed

This value is then stored in variable named x which is besides "float" (decimal number).

After that, we utilise the same method but this fourth dimension instead of passing "Horizontal" as a parameter we pass "Vertical" and store its render value in z variable. In this case method returns the following values:

  • 1 if player presses W or Up arrow key
  • -1 if player presses S or Down arrow key
  • 0 if those keys are not pressed

Now nosotros define a new vector called moveBy. This vector will  point in the direction our player is going to move in. That's why we employ vectors tranform.right and transform.forwards. Those vectors are pointing in right and forward direction respectively relative to players rotation. So their values are going to exist different if "FPS Character" has a Y rotation of (let's say) -90 degrees than if he has the rotation of xc degrees.

All we have to do at present is to actually move the player. At that place are multiple ways to do and then but we'll practise it by using MovePositionmethod that nosotros access through rb(Rigidbody).

That method but requires one parameter which is a position where our graphic symbol should be placed. Now, let's encounter why we passed it this value: "transform.position + moveBy.normalized * speed * Time.deltaTime".

transform.position is the current position of the graphic symbol. To information technology we add previously defined vector moveBy (later on nosotros normalized information technology) multiplied by speed variable multiplied by Time.deltaTime variable.

Normalizing vector basically caps its total length to 1 but it still keeps its management. This is needed because in the instance of diagonal movement nosotros still want our graphic symbol to move past 1 unit of measurement (and not i.41 units) just so we proceed the speed of our graphic symbol persistent.

Time.deltaTime variable is the value of 1 divided by FPS (number of frames per second). So if let'southward say our game runs at stable 60 fps, the value of Time.deltaTime is going to be 0.016 (basically every frame volition take 16 milliseconds to render). In this example nosotros multiply our vector with it in guild to get the illusion of motion. Otherwise character would basically "jump" from one place to some other and it wouldn't look good.

Now, save the script and go back to Unity.

By default speed variable in our script has a value of 0.

To alter that practice the following:

  • Select "FPS Graphic symbol"

  • Find "FPS Motion" component

  • Set its exposed parameter "Speed" to 12

Setting value of "speed" variable in editor
Setting value of "speed" variable in editor

Testing movement

Now, in club to test our script let's create a level in which we can movement our character.

  • Right click in Bureaucracy window
  • Go to 3D Object -> Plane

When you do and so "FPS Character" collider will clip through newly create plane then to avoid whatever glitches let'due south motion the character upwards a bit.

  • Select "FPS Character"
  • Set its Y position to i

If we now try to run the game it volition work simply we'll hardly see whatsoever motility because there'southward nothing in our sight, everything is the same, no thing where we are in the scene (well, by and large). And so allow's create a cube and place it in front of the character to brand our chore a fleck easier.

  • Right click in Hierarchy window
  • Go to 3D Object -> Cube
  • Select newly created "Cube" game object
  • Find its Transform component in the Inspector and click those 3 vertically stacked dots in upper correct corner
  • Selection "Reset" selection
Reseting "Cube" transform position
Reseting "Cube" transform position

Now the Cube transform is back to default values (0, 0, 0).

Set "Cube" position to be (0, 1, 5) so that yous can see information technology in front of grapheme in Game view.

Now press "Play" and attempt moving with WASD keys.


Virtual Reality Mini-Degree

Become a professional VR developer. Learn to lawmaking and create sixteen immersive games in Unity from the footing upwards. No prior programming experience is necessary to enroll.

VR Game Development Course on Zenva Academy
VR Game Development Course on Zenva University

https://academy.zenva.com/product/the-complete-virtual-reality-game-development-course/?a=294&campaign=VRGameDev


Looking effectually with mouse

Now we need to brand our character await around when we move our mouse. To do so let'south add another script to "FPS Character".

  • Select "FPS Character"
  • Click "Add Component"
  • Type in "FPSLookAround" (once again, don't apply any spaces)
  • Pick "New Script"
  • Click "Create and Add together"

"FPSLookAround" script is going to appear in the Project window and it will also be attached to our character.

At present, open up the script and add the following variables at the elevation of "FPSLookAround" class.

[SerializeField] Transform cam; [SerializeField] float sensitivity; float headRotation = 0f;

Variables cam is going to exist our reference to "Main Camera" game object. In this game photographic camera is basically acting as our grapheme'due south caput and by rotating camera we'll brand our character look in a dissimilar direction.

Adjacent up, variable sensitivityis telling our script how fast is our grapheme's head going to rotate when we move our mouse. This is basically a mouse sensitivity option yous take in every FPS game nowadays.

Both of these ii variables take [SerializeFiled] flag in front of them and so that nosotros can modify them within the editor.

headRotation variable is going to keep track of how much is graphic symbol's head rotated. Nosotros demand to continue that every bit a separate variable to be able to limit head rotation in the next section of this tutorial.

Now, to really look around we need to change Update method, similar this:

void Update() {     float x = Input.GetAxis("Mouse X") * sensitivity * Time.deltaTime;     bladder y = Input.GetAxis("Mouse Y") * sensitivity * Fourth dimension.deltaTime * -1f;      transform.Rotate(0f, ten, 0f);      headRotation += y;     cam.localEulerAngles = new Vector3(headRotation, 0f, 0f); }

As yous can meet nosotros first define variable x. This function works similarly to movement lawmaking. Basically, we first call Input.GetAxis("Mouse X") method, which returns the post-obit:

  • 1 when we movement our mouse to the correct
  • -ane when we move our mouse to the left
  • 0 when we are not moving the mouse

Then, nosotros multiply it by sensitivity and Time.deltaTime variables both of which I already explained.

After that, we ascertain variable y. There are two differences on this line when compared to the previous one.

First of all, nosotros pass "Mouse Y" as parameter to GetAxis method. It will piece of work the same as the one on previous line simply in this instance it's checking for whether or non nosotros're moving our mouse up or down.

2nd difference is that nosotros multiply everything on this line with -one. If we were not to practise so our characters head would await down when we mouse our mouse up and vice versa, which is not the intended result in this example.

Side by side up, we rotate our graphic symbol's transform by x on Y centrality. By doing this our character will await correct or left depending on how we motility the mouse. Nosotros need to rotate grapheme's whole transform because nosotros want transform.frontward vector to always be the direction in which we're looking.

Later that, we add value of y to headRotation and set camera's ten rotation to headRotation. In this case nosotros but rotate camera's transform and not the whole character because we don't want vertical mouse movement to affect our character's movement direction.

What is localEulerAngles? Unity uses Quaternions to calculate rotation and those are pretty complicated to sympathise. So localEulerAngles is basically a Quaternion converted to its respective vector value then that we tin can understand it more easily.

At present, save the script and go back to Unity. We need to set up the values for sensitivity and cam variables.

  • Select "FPS Character"
  • Observe "FPSLookAround" component
  • Set sensitivity to be 300

Now, in order to add a reference to "Primary Camera" object:

  • Find "Principal Photographic camera" game object
  • Elevate and drib it into cam slot (brand sure not to select Main Camera, if you do then you won't be able to run across "FPSLookAround" component in the Inspector)
Drag and drop "Main Camera" into "cam" slot
Drag and drop "Chief Photographic camera" into "cam" slot

Now printing play and endeavour moving your mouse around.

Limiting head rotation

If you now start moving your mouse upward eventually our camera is going to look backside our grapheme'due south dorsum and you lot'll see the whole scene rotated upside downwardly.

To preclude this from happening nosotros need to limit head's (or rather "Main Camera"'s) rotation. And then go back to "FPSLookAround" script and add together this variable at the tiptop of the grade:

[SerializeField] float headRotationLimit = 90f;

In this case, maximum value for "Main Camera"'s rotation X centrality is going to exist ninety (degrees). You can modify this value here in lawmaking or past going back to the inspector finding "FPSLookAround" component, as nosotros did with other variables.

Now, to actually limit photographic camera's rotation we need to modify last part of Update method, like this:

headRotation += y; headRotation = Mathf.Clamp(headRotation, -headRotationLimit, headRotationLimit); cam.localEulerAngles = new Vector3(headRotation, 0f, 0f);

As you tin can run into nosotros've now added i more than line of lawmaking before applying headRotation to camera. On that new line we're calling Mathf.Clench method that requires 3 parameters: number we want to clamp, lower limit and upper limit. This method basically doesn't allow headRotation value to be smaller than the lower limit or larger than the upper limit. In our case headRotation is always going to be somewhere in betwixt -ninety and 90 degrees.

Save the script, go back in the editor and try playing the game. If you did everything right the bug nosotros had at the offset of this department is now resolved.


Multiplayer Game Evolution Mini-Degree
The world's kickoff on-demand curriculum to teach ANYONE how to code and build impressive multiplayer games with Unity and Photon – build a battle royale, RPG, turn-based game and more than!

Multiplayer Game Development Course on Zenva Academy
Multiplayer Game Development Course on Zenva Academy

https://university.zenva.com/production/multiplayer-game-development-mini-degree/?a=294&campaign=MultiplayerGameDev


Lock and hide cursor

Now when we play we have another result. Our mouse isn't confined to the game view and if we accidentally click somewhere outside Game view our game will go out of focus and we won't exist able to control it until we click somewhere inside the Game view again.

To set this let's modify the First method (or add it if you deleted it), similar this:

void Start() {     Cursor.visible = false;     Cursor.lockState = CursorLockMode.Locked; }

Firstly, nosotros hide the cursor past setting its visible property to false.

Secondly, nosotros set lock state of our cursor to Locked. Past doing this our cursor won't move anywhere (information technology volition exist fixed at the center of Game view) but Unity is still going to recognize when we move our mouse so "FPSLookAround" script is still going to work properly.

Now, you can try playing the game to see if it works correctly.

Notation: To stop the game first press ESC key, when you practise so cursor volition get visible again and y'all'll be able to stop the game.

Jumping

In FPS games we unremarkably have option to jump and then let's add that functionality to our game likewise.

  • Select "FPS Character"
  • Click "Add together Component"
  • Blazon in "FPSJump" (don't use whatsoever spaces otherwise you lot'll get error messages)
  • Pick "New Script"
  • Click "Create and Add"

Add these two variables at the superlative of the "FPSJump" class:

Rigidbody rb; [SerializeField] float jumpForce;

Variable rb is going to be our reference to our character's Rigidbody component (same every bit with movement). We need it because we desire to utilize Unity's physics organization to make the graphic symbol jump.

Variable jumpForce is used to determine with how high nosotros want our grapheme to spring.

Next upwards, let'due south modify the Start method:

void Start() {     rb = GetComponent<Rigidbody>(); }

Here nosotros get the reference to the Rigidbody component.

Jumping is going to be performed inside of the Update method, like this:

void Update() {     if (Input.GetKeyDown(KeyCode.Infinite)) {         rb.AddForce(Vector3.upwards * jumpForce, ForceMode.Impulse);     } }

So we first check if Space key is downwardly / pressed. If so we add upward force to our Rigidbody multiplied by jumpForce. Here nosotros're not using Time.deltaTime because physics engine makes the spring smooth on its ain.

As a 2nd parameter to AddForce method we passed ForceMode.Impulse. This applies an instant forcefulness to the Rigidbody as opposed to continuous force (which would be the case if we were to exit the default option).

  • Save and go back to editor.
  • Select "FPS Character"
  • Find "FPSJump" component in the Inspector
  • Gear up "Spring Force" to 4

Press play to exam it out.

Ground checking

If you now try pressing space multiple times in a short time span yous'll run across that histrion volition basically get-go flying.

FPS Character can jump infinitely
FPS Character tin can jump infinitely

To fix this nosotros should first check whether or not grapheme is on the ground before we allow him jump. And then allow's first add an object where our character'due south anxiety would exist, like this:

  • Correct click on "FPS Character" in Bureaucracy view
  • Pick "Create Empty"
  • Rename this object to "GroundChecker"
  • Reset "GroundChecker"'due south position to (0, 0, 0)

"GroundChecker" should now be a child object of "FPS Character" and if you cheque it in Scene view information technology should be placed at the bottom of our character'due south capsule collider.

Now let's change "FPSJump" script so that it checks whether or non role player is on the ground. Open up "FPSJump" script and add these 3 variables to it.

[SerializeField] Transform groundChecker; [SerializeField] float checkRadius; [SerializeField] LayerMask groundLayer;

Starting time of all, we need a reference to "GroundChecker" object'southward Transform component (because nosotros need its position in this example) and that's exactly what groundChecker variable is going to exist.

To discover if player is on the basis we'll spawn an imaginary sphere at the same position as "GroundChecker" game object that will have a radius that'south equal to checkRadius. If this imaginary sphere collides with footing object then we know that histrion is on the ground.

Next up, we take groundLayer variable. Basically, every object that's considered to be ground will exist on a separate layer than everything else. This manner we tin specifically notice ground object and non mistakenly detect something else and think that information technology's a footing. For example, imaginary sphere that nosotros're spawning to detect ground won't detect our "FPS Character"'due south collider and retrieve that it's ground considering information technology will exist on a dissimilar layer.

To check if actor is on the basis we'll apply a separate method chosen "IsOnGround", to do so add this piece of code later the Update method:

bool IsOnGround() {     Collider[] colliders = Physics.OverlapSphere(groundChecker.position, checkRadius, groundLayer);      if (colliders.Length > 0) {         return true;     }else {         return fake;     } }

Equally you tin can see, this method returns a boolean value (and so true or false) and it requires no parameters.

The first line of code inside the method basically spawns an imaginary sphere by calling OverlapSphere method that's inside Physics grade. Starting time parameter this method requires is a position at which center of our imaginary sphere is going to be, 2nd parameter is radius of that sphere and the tertiary parameter is layer at which all ground objects are placed.

As you can see all three parameters use variables that we already defined.

OverlapSphere method returns an array of colliders that our imaginary sphere overlaps with. We store that array inside colliders variable.

So now, only thing that is left to do is to check whether or not OverlapSphere detected anything. If it did and so colliders array length is going to be larger than 0, which means that out character is continuing on the ground so we render true. If OverlapSphere did non detect anything colliders array length is going to be equal to 0 in which instance nosotros return imitation.

We now merely have to call "IsOnGround" method inside Update method before we actually jump. So change your update method like this:

void Update() {     if (Input.GetKeyDown(KeyCode.Space) && IsOnGround()) {         rb.AddForce(Vector3.upwardly * jumpForce, ForceMode.Impulse);     } }

Equally you can run across, now there are two conditions that need to be met before we jump. Offset of all, we need to press Space key and secondly our character needs to exist standing on the ground ("IsOnGround" method needs to return true).

Salvage the script and go back to Unity.

Now we need to assign values to all new variables in "FPSJump" script that we divers. First of all let's set up a layer for our ground object. In our case, basis object is actually "Plane" (if yous haven't renamed it).

  • Select "Aeroplane" in Hierarchy window
  • In upper right corner in the Inspector find "Layer" holding
  • Open up the drop downward carte du jour
  • Choice "Add Layer…"
  • Then set "User Layer eight" to "Ground"
  • Select "Plane" over again
  • Find "Layer" holding again
  • Open up up the drop down menu and select "Ground"
  • Save the scene
Adding new layer called "Ground"
Adding new layer called "Ground"
  • Select "FPS Grapheme"
  • Discover "FPSJump" component
  • Drag and drib "GroundChecker" game object into "Ground Checker" slot
  • Set "Check Radius" to 0.25
  • Prepare "Ground Layer" to "Ground"

Press Play to examination it. At present you shouldn't be able to jump indefinitely.

Sprinting

Now, let'south add sprinting to our controller.

Open up "FPSMovement" script and add together this one variable:

[SerializeField] float sprintMultiplier = ane.5f;

After that, modify part of Update method after we divers moveBy vector similar this:

bladder actualSpeed = speed; if (Input.GetKey(KeyCode.LeftShift)) {     actualSpeed *= sprintMultiplier; }  rb.MovePosition(transform.position + moveBy.normalized * actualSpeed * Fourth dimension.deltaTime);

As you tin can see we first make a re-create of speed variable and so that nosotros don't modify it because we nonetheless want our default speed to stay the same when we play.

Then, if Left Shift key (you can set whichever key yous want) is pressed that copy of speed variables is going to be multiplied past sprintMultiplier value (which we previously defined), so by 1.five in this instance. Basically, sprinting speed is going to exist larger than normal speed by 50%.

Then, when we actually perform the movement we will multiply moveBy vector by actualSpeed variable instead of speed variable.

Now, save the script, go back to Unity and press Play to test it out.

Crouch / Lie down

Now permit'south add together the option to hunker or lie down.

  • Select "FPS Character"
  • Click "Add together Component"
  • Blazon in "FPSCrouch" (don't use any spaces otherwise you'll get error letters)
  • Pick "New Script"
  • Click "Create and Add"

Open up newly created script and at the height of "FPSCrouch" class add these 2 variables:

[SerializeField] bladder crouchHeight; [SerializeField] float lyingHeight; [SerializeField] bladder normalHeight;

The basic idea is that nosotros'll change the height of our grapheme depending on if he's continuing, crouching or lying down. So these iii variables define character's height in each scenario.

Side by side upward, alter the Update method like this:

void Update() {     Vector3 newScale = new Vector3(transform.localScale.x, normalHeight, transform.localScale.z);      if (Input.GetKey(KeyCode.C)) {         newScale.y = crouchHeight;     } else if (Input.GetKey(KeyCode.Z)) {         newScale.y = lyingHeight;     }      transform.localScale = newScale; }

To change the height of our grapheme we need to change his scale, so starting time of all we need to access it. We do that through transform.localScale variable.

In this case we want to ascertain new scale for the grapheme (which is of type Vector3). We'll telephone call that variable newScale and gear up it's X and Z components to be the aforementioned as the electric current local scale. Only Y component is going to modify for our iii states and by default it's going to take a value of normalHeight.

In the case in which thespian holds C key Y should be equal to crouchHeight or to lyingHeight if thespian is holding Z key.

Later that we simply take to set character's local calibration to be equal to newScale.

Save the script and go back to editor.

  • Select "FPS Grapheme"
  • Find "FPSCrouch" script
  • Set "Hunker Height" to 0.5
  • Set up "Lying Peak" to 0.25
  • Set "Normal Superlative" to 1

Press play to test. If you prepare the character the aforementioned way I did in first section of this tutorial collider of the grapheme will as well adapt to new height.

Outro

If yous followed this tutorial step-by-step yous should at present have a total FPS Controller that you can play with and further ameliorate. If yous have any questions let me know down in the comments blare.

All scripts that I've made for this tutorial can be downloaded from here: FPS Movement Scripts.

Hopefully, this tutorial helped y'all. If it did definitely Subscribe to my Newsletter I programme on making more game dev tutorials related to FPS games coming soon.

Thank you for reading!

Source: https://craftgames.co/unity-3d-fps-movement/

Posted by: bermangreirrom.blogspot.com

0 Response to "What Camera Does Tyler1 Use"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel