T . Kathiravan
1 min readApr 10, 2021

Basic Player Movement: Unity 3D

The player movement can be done in many different ways.

So to define what is movement — is a change in position.

Let’s see how we can do it in Unity -

1.Moving Object with Transform

// creating function in update method for moving Object

// get the position of the player

//getting the input value of leftArrow,rightArrow or “a” and “d” key pressed

//multiplying the xInput value by speed and Time.delta time and assign it to temporary position

// reassgin the updated value to transform position

Moving Object with Transform

2.Moving with Translate

Moving Object with Translate

Translate is a method for Transform object which takes Vector3 as parameter transform.Translate(0,0,1) is same as transform.Translate(Vector3.forward) and transform.Translate(1,0,0) is same as transform.Translate(Vector3.right) and here the xInput values corresponds to +1 to -1 (for positive values the object moves in the “+x” nd it is reversed “-x” for negative values) and same is the case for zInput

No responses yet