aspiring
0
Q:

unity how to move character using transform

using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        // Move the object forward along its z axis 1 unit/second.
        transform.Translate(Vector3.forward * Time.deltaTime);        // Move the object upward in world space 1 unit/second.
        transform.Translate(Vector3.up * Time.deltaTime, Space.World);
    }
}
0
Using UnityEngine;
Using System.Collections;

public class MovementExample : MonoBehaviour

public float speed = 5f;

void update()
{
  	//2D Top Down
	tranform.Translate(Vector3.up * Time.deltaTime * speed);
  	//3D
  	tranfrom.Translate(Vector3.forward * Time.deltaTime * speed);
}

//The more appropriate way to move in 3D is to use a Character Controller on your GameObject!
0

New to Communities?

Join the community