ActionTest.cs
924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
using UnityEngine.SceneManagement;
public class ActionTest : MonoBehaviour
{
public SteamVR_Input_Sources handType; // 모두 사용, 왼손, 오른손
public SteamVR_Action_Boolean teleportAction; // 텔레포트 액션
public SteamVR_Action_Boolean grabAction; // 그랩 액션
void Start()
{
}
void Update()
{
if (GetTeleportDown())
{
Debug.Log("Teleport" + handType);
}
if (GetGrab())
{
Debug.Log("Grab" + handType);
}
}
// 텔레포트가 활성화되면 true 반환
public bool GetTeleportDown()
{
return teleportAction.GetStateDown(handType);
}
// 잡기 액션이 활성화되어 있으면 true 반환
public bool GetGrab()
{
return grabAction.GetState(handType);
}
}