iLMS知識社群歷程檔登入
位置: 黃國哲 > Unity
1091226 製作遙控器
by 黃國哲 2020-12-26 08:05:22, 回應(0), 人氣(413)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class 遙控器 : MonoBehaviour
{

    public GameObject controller1 ;  //宣告要被遙控的對象

//設計控制面板的按鈕

    public void rightbtn ()
    {controller1.transform.position += new Vector3(0.1f,0,0);}
    public void leftbtn ()
    {controller1.transform.position += new Vector3(-0.1f,0,0);}
    public void upbtn ()
    {controller1.transform.position += new Vector3(0,0,0.1f);}
    public void downbtn ()
    {controller1.transform.position += new Vector3(0,0,-0.1f);}

}

回應