SkeletonUIOptions.cs
2.39 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
using UnityEngine;
using System.Collections;
using Valve.VR.InteractionSystem;
namespace Valve.VR.InteractionSystem.Sample
{
public class SkeletonUIOptions : MonoBehaviour
{
public void AnimateHandWithController()
{
for (int handIndex = 0; handIndex < Player.instance.hands.Length; handIndex++)
{
Hand hand = Player.instance.hands[handIndex];
if (hand != null)
{
hand.SetSkeletonRangeOfMotion(Valve.VR.EVRSkeletalMotionRange.WithController);
}
}
}
public void AnimateHandWithoutController()
{
for (int handIndex = 0; handIndex < Player.instance.hands.Length; handIndex++)
{
Hand hand = Player.instance.hands[handIndex];
if (hand != null)
{
hand.SetSkeletonRangeOfMotion(Valve.VR.EVRSkeletalMotionRange.WithoutController);
}
}
}
public void ShowController()
{
for (int handIndex = 0; handIndex < Player.instance.hands.Length; handIndex++)
{
Hand hand = Player.instance.hands[handIndex];
if (hand != null)
{
hand.ShowController(true);
}
}
}
public void SetRenderModel(RenderModelChangerUI prefabs)
{
for (int handIndex = 0; handIndex < Player.instance.hands.Length; handIndex++)
{
Hand hand = Player.instance.hands[handIndex];
if (hand != null)
{
if (hand.handType == SteamVR_Input_Sources.RightHand)
hand.SetRenderModel(prefabs.rightPrefab);
if (hand.handType == SteamVR_Input_Sources.LeftHand)
hand.SetRenderModel(prefabs.leftPrefab);
}
}
}
public void HideController()
{
for (int handIndex = 0; handIndex < Player.instance.hands.Length; handIndex++)
{
Hand hand = Player.instance.hands[handIndex];
if (hand != null)
{
hand.HideController(true);
}
}
}
}
}