ShowController.cs 711 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Valve.VR.InteractionSystem;
  5. public class ShowController : MonoBehaviour
  6. {
  7. public bool ControllerVisible = false;
  8. // Update is called once per frame
  9. void Update()
  10. {
  11. foreach (var hand in Player.instance.hands)
  12. if (ControllerVisible)
  13. {
  14. hand.ShowController();
  15. hand.SetSkeletonRangeOfMotion(Valve.VR.EVRSkeletalMotionRange.WithController);
  16. }
  17. else
  18. {
  19. hand.HideController();
  20. hand.SetSkeletonRangeOfMotion(Valve.VR.EVRSkeletalMotionRange.WithoutController);
  21. }
  22. }
  23. }