2019年3月26日 星期二

Week07 李宜謙

寫出按下扣板機就會印出yes

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;//自己寫的
public class mycode : MonoBehaviour
{
public SteamVR_Action_Boolean trigger;///按下按鈕出現數值
// Start is called before the first frame update
void Start()
{

}
// Update is called once per frame
void Update()
{
if (trigger.GetState(SteamVR_Input_Sources.Any)
{
print("yes");///當手把按下按鈕出現yes
}
}
}
按下扣板機會不斷生成球
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;//自己寫的
public class mycode : MonoBehaviour
{
public SteamVR_Action_Boolean trigger;///按下按鈕出現數值
public GameObject mySphere;
// Start is called before the first frame update
void Start()
{

}
FLOAT X=0;
// Update is called once per frame
void Update()
{
if (trigger.GetState(SteamVR_Input_Sources.Any)
{
print("yes");///當手把按下按鈕出現yes
}
GameObject now= Instantiate(mySphere);
now.transform.position =new Vector3(x,0,0);
偵測手把位置並在偵測處生成出一顆球
}
}
比較可惜的是我們小組始終沒有成功


沒有留言:

張貼留言