2016年11月17日 星期四

three D 球







  using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {
        public GameObject obj_Player;
        // Use this for initialization
        void Start () {
        
        }
        
        // Update is called once per frame
        void Update ()
        {
                
                obj_Player = GameObject.Find("Sphere");
                if (Input.GetKeyDown (KeyCode.A)) {
                        obj_Player.transform.position += new Vector3 (-0.1f, 0, 0);
                } else if (Input.GetKeyDown (KeyCode.D)) {
                        obj_Player.transform.position += new Vector3 (0.1f, 0, 0);
                } else if (Input.GetKeyDown (KeyCode.W)) {
                        obj_Player.transform.position += new Vector3 (0, 0, 0.1f);
                } else if (Input.GetKeyDown (KeyCode.S)) {
                        obj_Player.transform.position += new Vector3 (0, 0, -0.1f);
                }
        }

}

沒有留言:

張貼留言