Exemple #1
0
        // TODO See if this method can be removed, it appears to not be used at all and it can be misleading when debugging.
        /// <summary>
        /// Instantiates a <see cref="VRControllerVisual"/> for a limb.
        /// </summary>
        /// <param name="limb">The limb for the controller.</param>
        /// <returns>The newly instantiated controller visual for the specified limb, or null if no controller visual was able to be created.</returns>
        public VRControllerVisual InstantiateControllerVisual(IVRAvatarLimb limb)
        {
            if (limb == null)
            {
                throw new ArgumentNullException("limb");
            }

            if (limb.LimbType == VRAvatarLimbType.Head)
            {
                return(null);
            }

            var prefab   = VRAvatarHelper.EnsureLoadPrefab <VRControllerVisual>(ControllerVisualPrefabName);
            var instance = Instantiate(prefab);

            var ovrController = instance.GetComponent <UnityXRControllerVisual>();

            ovrController.m_controller = GetControllerTypeForLimb(limb);
            ovrController.m_modelGearVrController.SetActive(true);
            ovrController.enabled = false;

            instance.gameObject.SetActive(true);

            return(instance);
        }
Exemple #2
0
        private OVRInput.Controller GetControllerTypeForLimb(IVRAvatarLimb limb)
        {
            if (limb.LimbType == VRAvatarLimbType.LeftHand)
            {
                return(OVRInput.Controller.LTouch);
            }

            if (limb.LimbType == VRAvatarLimbType.RightHand)
            {
                return(OVRInput.Controller.RTouch);
            }

            return(OVRInput.Controller.None);
        }
 public VRControllerVisual InstantiateControllerVisual(IVRAvatarLimb limb)
 {
     // We don't need to make the controllers. SteamVR handles it all.
     return(null);
 }