BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / Avatar / Scripts / OvrAvatarTouchController.cs

OvrAvatarTouchController.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
OvrAvatarTouchController.cs 979 B Download Raw
1using Oculus.Avatar;
2
3public class OvrAvatarTouchController : OvrAvatarComponent
4{
5 public bool isLeftHand = true;
6 ovrAvatarControllerComponent component = new ovrAvatarControllerComponent();
7
8 void Update()
9 {
10 if (owner == null)
11 {
12 return;
13 }
14
15 bool hasComponent = false;
16 if (isLeftHand)
17 {
18 hasComponent = CAPI.ovrAvatarPose_GetLeftControllerComponent(owner.sdkAvatar, ref component);
19 }
20 else
21 {
22 hasComponent = CAPI.ovrAvatarPose_GetRightControllerComponent(owner.sdkAvatar, ref component);
23 }
24
25 if (hasComponent)
26 {
27 UpdateAvatar(component.renderComponent);
28 }
29 else
30 {
31 if (isLeftHand)
32 {
33 owner.ControllerLeft = null;
34
35 }
36 else
37 {
38 owner.ControllerRight = null;
39 }
40
41 Destroy(this);
42 }
43 }
44}