BlueGit

blue-star ggj-2020

Files

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

OvrAvatarBody.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
OvrAvatarBody.cs 996 B Download Raw
1using UnityEngine;
2using System.Collections;
3using System.Collections.Generic;
4using System;
5using Oculus.Avatar;
6public class OvrAvatarBody : OvrAvatarComponent
7{
8 public ovrAvatarBodyComponent component = new ovrAvatarBodyComponent();
9
10 public ovrAvatarComponent? GetNativeAvatarComponent()
11 {
12 if (owner == null)
13 {
14 return null;
15 }
16
17 if (CAPI.ovrAvatarPose_GetBodyComponent(owner.sdkAvatar, ref component))
18 {
19 CAPI.ovrAvatarComponent_Get(component.renderComponent, true, ref nativeAvatarComponent);
20 return nativeAvatarComponent;
21 }
22
23 return null;
24 }
25
26 void Update()
27 {
28 if (owner == null)
29 {
30 return;
31 }
32
33 if (CAPI.ovrAvatarPose_GetBodyComponent(owner.sdkAvatar, ref component))
34 {
35 UpdateAvatar(component.renderComponent);
36 }
37 else
38 {
39 owner.Body = null;
40 Destroy(this);
41 }
42 }
43}