BlueGit

blue-star ggj-2020

Files

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

OvrAvatarHand.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
OvrAvatarHand.cs 1.0 KiB Download Raw
1using UnityEngine;
2using System.Collections;
3using System.Collections.Generic;
4using System;
5using Oculus.Avatar;
6
7public class OvrAvatarHand : OvrAvatarComponent
8{
9 public bool isLeftHand = true;
10 ovrAvatarHandComponent component = new ovrAvatarHandComponent();
11
12 void Update()
13 {
14 if (owner == null)
15 {
16 return;
17 }
18
19 bool hasComponent = false;
20 if (isLeftHand)
21 {
22 hasComponent = CAPI.ovrAvatarPose_GetLeftHandComponent(owner.sdkAvatar, ref component);
23 }
24 else
25 {
26 hasComponent = CAPI.ovrAvatarPose_GetRightHandComponent(owner.sdkAvatar, ref component);
27 }
28
29 if (hasComponent)
30 {
31 UpdateAvatar(component.renderComponent);
32 }
33 else
34 {
35 if (isLeftHand)
36 {
37 owner.HandLeft = null;
38
39 }
40 else
41 {
42 owner.HandRight = null;
43 }
44
45 Destroy(this);
46 }
47 }
48}