OvrAvatarBody.cs
996 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
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using Oculus.Avatar;
public class OvrAvatarBody : OvrAvatarComponent
{
public ovrAvatarBodyComponent component = new ovrAvatarBodyComponent();
public ovrAvatarComponent? GetNativeAvatarComponent()
{
if (owner == null)
{
return null;
}
if (CAPI.ovrAvatarPose_GetBodyComponent(owner.sdkAvatar, ref component))
{
CAPI.ovrAvatarComponent_Get(component.renderComponent, true, ref nativeAvatarComponent);
return nativeAvatarComponent;
}
return null;
}
void Update()
{
if (owner == null)
{
return;
}
if (CAPI.ovrAvatarPose_GetBodyComponent(owner.sdkAvatar, ref component))
{
UpdateAvatar(component.renderComponent);
}
else
{
owner.Body = null;
Destroy(this);
}
}
}