123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //======= 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);
- }
- }
- }
- }
- }
|