hello,
i want to make object move on its own with c#
thanks,
hello,
i want to make object move on its own with c#
thanks,
transform.position += Vector3.forward * Time.deltaTime;
You can either move the object manually every frame by changing the transform.position, but if you want it to move “by itself”, based on physics, then you add a rigidbody component and give it some velocity:
rigidbody.velocity = transform.forward;
I warmly recommend starting with basic physics and scripting tutorials before asking questions because these basic concepts are well covered there:
http://unity3d.com/learn/tutorials/modules/beginner/physics/rigidbody
http://unity3d.com/learn/tutorials/modules/beginner/scripting/translate-and-rotate
@vexe. Sorry for late Reply…
public class CharacterMovement : MonoBehaviour
{
// Player Movement Variables/....
public static int movespeed = 1;
public Vector3 userDirection = Vector3.right;
public Start()
{
}
public void Update()
{
transform.Translate(userDirection * movespeed * Time.deltaTime);
}
}
-Prasanna