Learn C# Scripting for Unity (Moving GameObject)
The following instructions are meant to be used for the 3D environnement, if you are working on 2d , you just need to use rigidbody2d and vector2 instead of rigidbody and vector3 respectively.
For rigidbody2d you may need to add this before starting you class:
[RequireComponent(typeof(Rigidbody2D))]
In this section you will learn :
1 - Adding force to a gameObject to let it jump
2 - Move the object forward
To do this you need to attach a rigidbody component to you game object , create a new c sharp script and type the following :
Save it then back to unity and press run , press space button and see your code results .
Congrats , you have just learnt how to make objects move .
Comments
Post a Comment