Creating Basic Player Movement In Unity

Creating player movement in a game is often times the very first thing any developer does after setting up their project. It allows for user interactivity during playtesting as well as world navigation all in one.

[Note]

Most quality games that utilize movement in their core loop’s mechanics will add a lot of various functions to their scripts to fine-tune the mechanics to their specific goals in regards to game feel.

One simple way to get an object moving both on the horizontal axis & the vertical axis is like this…

[Additional Info]

Vector3.right = Positive X Axis

Vector3.up = Positive Y Axis

Vector3.forward = Positive Z Axis

By putting “.forward” in instead of “.up” in your Vector3 you will move your player up the “z-axis” instead of the “y-axis”.

To find the different built-in inputs go to Edit>ProjectSettings and you should see a window that looks like the one shown below. Select “Input Manager” and under the “Axes” drop menu you will find a list of all the different values that you can type in place of (“Horizontal”) or (“Vertical”) that we used above.

[Note]

By changing the number for “Size” under the “Axes” drop menu, you can add any number of new input axes from which you can assign custom controls and functions to!

--

--

--

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Top 10 Programming Languages

How I handled many-to-many relationship on Android using Kotlin and DBFlow

The unexpected journey of deploying a SonarQube Azure App Service

LAUNCHING AN APP/SERVER USING TERRAFORM-2

Basic CSS: Syntax

CRODO VS SolRazr: Battle Of Launchpads

3 video links for 07/05/20

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Reed

Adam Reed

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

More from Medium

Journal 148 — Unity Project Development, 2.5D Shooter

Introduction to Physics in Unity

Unity Dev Blog: How to Play Sound Effects in Unity Through C# Scripts

Making a Hack’n’slash #7: Using Scriptable Objects and Prefabs