2019年3月26日 星期二

Week06_珮妤的筆記


下載&import Steam VR 匯入需要的就好

讓手把變出球
using System.Collections;

using System.Collections.Generic;
using UnityEngine;
using Valve.VR;

public class MyScript : MonoBehaviour
{
    public SteamVR_Action_Boolean triggerDown;
    // Start is called before the first frame update
    public GameObject mysphere; 
    public GameObject myController;
    bool state=false; 
  
    void Update()
    {
        if(triggerDown.GetState(SteamVR_Input_Sources.Any))
        {
            if(state==false)
            {
                state=true;

                print("triggerDown");

            GameObject now=Instantiate(mysphere);
            //now.transform.position = new Vector3(x,0,0); 
            //x++;
            now.transform.position=myController.transform.position;
            }
        }
        else
        {
            state=false;
        }
    }    
}

沒有留言:

張貼留言