Programming

[Unity] UFO 한칸씩 움직이기

 2016. 8. 27. 17:46
반응형

단순한 방식으로 물체를 움직일 수 있는 방법

transform.Translate(new Vector3(x,y,z));

물체에 대한 다른 설정을 해주지 않아도 스크립트가 해당 물체에 걸려있기 때문에 자동으로 설정되는 것 같다.




using
 UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    public void moveObject(){
        transform.Translate (new Vector2(1,0));
    }
}

 



반응형