How to move an object in Unity 3D

How to move an Object Backward and Forward in Unity 3D ! 

First of all lets discuss some of the key words that are necessary to understand. 

Vector 3:
Its a representation of 3 vector points. You have listened the x ,y and z axis. So here vector 3 takes all the 3 values.
The points in the back and forward will be (0,0,-1), (0,0,1) respectively.

Time.deltatime: 
Function is used to make the game rate independent.
If you multiply the variable with time.delta time it means you are saying that i want to move the object 10 meter per second.
Basically you use delta time to update your movements.

Transform.translate: 
 Transform.translate is basically used for the movement of the object as it takes the 3 axis value to move the object.  It's related to the distance the object will move.


Now lets see some practical example to make a object working.

We take a cube for the example purpose. Then add script to it.


Now lets see the played situation. As my object is moving perfectly. 


Comments

Popular posts from this blog

Vector Math - Unity

Input.Getaxis, OnMouseDown, GetComponent< > - Unity Scripts

Transform.LocalEulerAngle, how to measure speed of rotational body- Unity 3D