Simple Player Movement — Unity

Simple Player Movement Banner

The Basics

Transform Component

Transform Component

Moving with script

Creating a C# script

Attaching script to a GameObject

Opening the script

Base Script Template

Set Position (Read First)

“transform.
Set to 0 0 0
transform.position = new Vector3(0, 0, 0);
transform.position = new Vector3(-5, 0, 2);
transform.position = new Vector3(6, -3, -20);
Unity 3D axis

Translation

FixedUpdate
transform.position += new Vector3(-1, 0, 0);
Smoother: transform.position += new Vector3(-1 * Time.deltaTime, 0, 0);
Changing the Vector3 By a variable and adding options

Now let’s talk SPACE!

Transform.Translte() Function

Using Unity Input

Bonus — Mouse position

I am an IT... hum.. Was. Now Aiming at software developping with Unity engine.

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