OvrAvatarTouchController.cs
979 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
43
44
using Oculus.Avatar;
public class OvrAvatarTouchController : OvrAvatarComponent
{
public bool isLeftHand = true;
ovrAvatarControllerComponent component = new ovrAvatarControllerComponent();
void Update()
{
if (owner == null)
{
return;
}
bool hasComponent = false;
if (isLeftHand)
{
hasComponent = CAPI.ovrAvatarPose_GetLeftControllerComponent(owner.sdkAvatar, ref component);
}
else
{
hasComponent = CAPI.ovrAvatarPose_GetRightControllerComponent(owner.sdkAvatar, ref component);
}
if (hasComponent)
{
UpdateAvatar(component.renderComponent);
}
else
{
if (isLeftHand)
{
owner.ControllerLeft = null;
}
else
{
owner.ControllerRight = null;
}
Destroy(this);
}
}
}