forked from sh-akira/VirtualMotionCapture
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandSwapManagerScript.cs
More file actions
67 lines (57 loc) · 1.74 KB
/
Copy pathHandSwapManagerScript.cs
File metadata and controls
67 lines (57 loc) · 1.74 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//gpsnmeajp
using UnityEngine;
namespace VMC
{
public class HandSwapManagerScript : MonoBehaviour
{
public bool Enable = true;
[Header("OpenVR (Input)")]
public string OpenVRLeftHand;
public string OpenVRRightHand;
[Header("WPF (Input)")]
public Transform WPFLeftHandTransform;
public Transform WPFRightHandTransform;
public string WPFLeftHand;
public string WPFRightHand;
[Header("Output")]
public bool HandSwap = false;
public SteamVR2Input steamVR2Input = null;
void Start()
{
}
void Update()
{
if (!Enable)
{
return;
}
if (WPFLeftHandTransform)
{
WPFLeftHand = WPFLeftHandTransform.name;
if (WPFLeftHand != null)
{
WPFLeftHand = WPFLeftHand.Replace("[Controller]", "");
}
}
if (WPFRightHandTransform)
{
WPFRightHand = WPFRightHandTransform.name;
if (WPFRightHand != null)
{
WPFRightHand = WPFRightHand.Replace("[Controller]", "");
}
}
OpenVRTrackerManager.Instance.GetControllerSerial(out OpenVRLeftHand, out OpenVRRightHand);
if (OpenVRLeftHand != null && OpenVRRightHand != null && OpenVRLeftHand == WPFRightHand && OpenVRRightHand == WPFLeftHand)
{
HandSwap = true;
steamVR2Input.handSwap = true;
}
else
{
HandSwap = false;
steamVR2Input.handSwap = false;
}
}
}
}