Ejemplo n.º 1
0
 public override string GetControllerElementPath(ControllerElelements element, VRTK_DeviceFinder.ControllerHand hand)
 {
     switch (element)
     {
         case ControllerElelements.AttachPoint:
             return "Model/tip/attach";
         case ControllerElelements.Trigger:
             return "Model/trigger";
         case ControllerElelements.GripLeft:
             return "Model/lgrip";
         case ControllerElelements.GripRight:
             return "Model/rgrip";
         case ControllerElelements.Touchpad:
             return "Model/trackpad";
         case ControllerElelements.ApplicationMenu:
             return "Model/button";
         case ControllerElelements.SystemMenu:
             return "Model/sys_button";
         case ControllerElelements.Body:
             return "Model/body";
     }
     return null;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// The PopulateHighlighters method sets up the highlighters on the controller model.
        /// </summary>
        public virtual void PopulateHighlighters()
        {
            highlighterOptions = new Dictionary <string, object>();
            highlighterOptions.Add("resetMainTexture", true);
            VRTK_BaseHighlighter objectHighlighter = VRTK_BaseHighlighter.GetActiveHighlighter(controllerAlias);

            if (objectHighlighter == null)
            {
                objectHighlighter = controllerAlias.AddComponent <VRTK_MaterialColorSwapHighlighter>();
            }

            SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(controllerAlias);

            objectHighlighter.Initialise(null, highlighterOptions);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonOne, controllerHand)), objectHighlighter, elementHighlighterOverrides.buttonOne);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonTwo, controllerHand)), objectHighlighter, elementHighlighterOverrides.buttonTwo);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Body, controllerHand)), objectHighlighter, elementHighlighterOverrides.body);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripLeft, controllerHand)), objectHighlighter, elementHighlighterOverrides.gripLeft);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripRight, controllerHand)), objectHighlighter, elementHighlighterOverrides.gripRight);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.StartMenu, controllerHand)), objectHighlighter, elementHighlighterOverrides.startMenu);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.SystemMenu, controllerHand)), objectHighlighter, elementHighlighterOverrides.systemMenu);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Touchpad, controllerHand)), objectHighlighter, elementHighlighterOverrides.touchpad);
            AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Trigger, controllerHand)), objectHighlighter, elementHighlighterOverrides.trigger);
        }
Ejemplo n.º 3
0
        private void Warp(bool blink = false, bool horizontal = false)
        {
            var distance       = warpRange * (multiplyMovement ? (horizontal ? horizontalMultiplier : verticalMultiplier) : 1);
            var deviceDirector = VRTK_DeviceFinder.DeviceTransform(deviceForDirection);
            var bodyPos        = playArea.TransformPoint(bodyCollider.center);
            var targetPos      = bodyPos + ((horizontal ? deviceDirector.right : deviceDirector.forward) * distance * ((horizontal ? touchAxis.x : touchAxis.y) < 0 ? -1 : 1));

            var        headMargin = 0.2f;
            RaycastHit rh;

            // direction raycast to stop near obstacles
            Vector3 direction = (horizontal ? (touchAxis.x < 0 ? headset.right : headset.right * -1) : (touchAxis.y > 0 ? headset.forward : headset.forward * -1));

            if (Physics.Raycast(headset.position + (Vector3.up * headMargin), direction, out rh, distance))
            {
                targetPos = rh.point - (direction * bodyCollider.radius);
            }

            // vertical raycast for height position
            if (Physics.Raycast(targetPos + (Vector3.up * (warpMaxAltitudeChange + headMargin)), Vector3.down, out rh, (warpMaxAltitudeChange + headMargin) * 2))
            {
                targetPos.y = rh.point.y + (bodyCollider.height / 2);

                lastWarp          = Time.timeSinceLevelLoad + warpDelay;
                playArea.position = targetPos - bodyPos + playArea.position;

                if (blink)
                {
                    blinkFadeInTime = warpDelay * blinkDurationMultiplier;
                    VRTK_SDK_Bridge.HeadsetFade(Color.black, 0);
                    Invoke("ReleaseBlink", 0.01f);
                }

                OnAxisMovement(AxisMovementType.Warp, (horizontal ? (touchAxis.x < 0 ? AxisMovementDirection.Left : AxisMovementDirection.Right) : (touchAxis.y < 0 ? AxisMovementDirection.Backward : AxisMovementDirection.Forward)));
            }
        }
Ejemplo n.º 4
0
        private Transform GetSnapHandle(VRTK_InteractableObject objectScript)
        {
            if (objectScript.rightSnapHandle == null && objectScript.leftSnapHandle != null)
            {
                objectScript.rightSnapHandle = objectScript.leftSnapHandle;
            }

            if (objectScript.leftSnapHandle == null && objectScript.rightSnapHandle != null)
            {
                objectScript.leftSnapHandle = objectScript.rightSnapHandle;
            }

            if (VRTK_DeviceFinder.IsControllerOfHand(gameObject, VRTK_DeviceFinder.ControllerHand.Right))
            {
                return(objectScript.rightSnapHandle);
            }

            if (VRTK_DeviceFinder.IsControllerOfHand(gameObject, VRTK_DeviceFinder.ControllerHand.Left))
            {
                return(objectScript.leftSnapHandle);
            }

            return(null);
        }
Ejemplo n.º 5
0
        private void Awake()
        {
            gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
            cachedElements   = new Dictionary <string, Transform>();

            var controllerHand = VRTK_DeviceFinder.GetControllerHand(gameObject);

            if (modelElementPaths.bodyModelPath.Trim() == "")
            {
                modelElementPaths.bodyModelPath = VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.Body, controllerHand);
            }
            if (modelElementPaths.triggerModelPath.Trim() == "")
            {
                modelElementPaths.triggerModelPath = VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.Trigger, controllerHand);
            }
            if (modelElementPaths.leftGripModelPath.Trim() == "")
            {
                modelElementPaths.leftGripModelPath = VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.GripLeft, controllerHand);
            }
            if (modelElementPaths.rightGripModelPath.Trim() == "")
            {
                modelElementPaths.rightGripModelPath = VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.GripRight, controllerHand);
            }
            if (modelElementPaths.touchpadModelPath.Trim() == "")
            {
                modelElementPaths.touchpadModelPath = VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.Touchpad, controllerHand);
            }
            if (modelElementPaths.appMenuModelPath.Trim() == "")
            {
                modelElementPaths.appMenuModelPath = VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.ApplicationMenu, controllerHand);
            }
            if (modelElementPaths.systemMenuModelPath.Trim() == "")
            {
                modelElementPaths.systemMenuModelPath = VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.SystemMenu, controllerHand);
            }
        }
Ejemplo n.º 6
0
 protected virtual void SetControllerType()
 {
     controllerType = (controllerReference != null ? VRTK_DeviceFinder.GetCurrentControllerType(controllerReference) : SDK_BaseController.ControllerType.Undefined);
 }
Ejemplo n.º 7
0
 public static Transform GetControllerOrigin(GameObject controller)
 {
     return(VRTK_DeviceFinder.GetControllerOrigin(VRTK_ControllerReference.GetControllerReference(controller)));
 }
Ejemplo n.º 8
0
 protected virtual void Awake()
 {
     VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig);
     headset  = VRTK_SharedMethods.AddCameraFade();
     playArea = VRTK_DeviceFinder.PlayAreaTransform();
 }
        protected virtual void SetControllerAttachPoint()
        {
            //If no attach point has been specified then just use the tip of the controller
            if (controllerReference.model != null && originalControllerAttachPoint == null)
            {
                //attempt to find the attach point on the controller
                Transform defaultAttachPoint = controllerReference.model.transform.Find(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.AttachPoint, VRTK_DeviceFinder.GetControllerHand(interactTouch.gameObject)));
                if (defaultAttachPoint != null)
                {
                    controllerAttachPoint = defaultAttachPoint.GetComponent <Rigidbody>();

                    if (controllerAttachPoint == null)
                    {
                        var autoGenRB = defaultAttachPoint.gameObject.AddComponent <Rigidbody>();
                        autoGenRB.isKinematic = true;
                        controllerAttachPoint = autoGenRB;
                    }
                }
            }
        }
Ejemplo n.º 10
0
        protected override VRTK_ObjectControl GetOtherControl()
        {
            GameObject foundController = (VRTK_DeviceFinder.IsControllerLeftHand(gameObject) ? VRTK_DeviceFinder.GetControllerRightHand(false) : VRTK_DeviceFinder.GetControllerLeftHand(false));

            if (foundController)
            {
                return(foundController.GetComponentInChildren <VRTK_ButtonControl>());
            }
            return(null);
        }
Ejemplo n.º 11
0
 private void Start()
 {
     controllerIndex = VRTK_DeviceFinder.GetControllerIndex(gameObject);
 }
Ejemplo n.º 12
0
        private void Update()
        {
            controllerIndex = VRTK_DeviceFinder.GetControllerIndex(gameObject);
            //Only continue if the controller index has been set to a sensible number
            if (controllerIndex >= uint.MaxValue)
            {
                return;
            }

            Vector2 currentTriggerAxis  = VRTK_SDK_Bridge.GetTriggerAxisOnIndex(controllerIndex);
            Vector2 currentTouchpadAxis = VRTK_SDK_Bridge.GetTouchpadAxisOnIndex(controllerIndex);

            //Trigger Pressed
            if (VRTK_SDK_Bridge.IsTriggerPressedDownOnIndex(controllerIndex))
            {
                OnTriggerPressed(SetButtonEvent(ref triggerPressed, true, currentTriggerAxis.x));
                EmitAlias(ButtonAlias.Trigger_Press, true, currentTriggerAxis.x, ref triggerPressed);
            }
            else if (VRTK_SDK_Bridge.IsTriggerPressedUpOnIndex(controllerIndex))
            {
                OnTriggerReleased(SetButtonEvent(ref triggerPressed, false, 0f));
                EmitAlias(ButtonAlias.Trigger_Press, false, 0f, ref triggerPressed);
            }

            //Trigger Touched
            if (VRTK_SDK_Bridge.IsTriggerTouchedDownOnIndex(controllerIndex))
            {
                OnTriggerTouchStart(SetButtonEvent(ref triggerTouched, true, currentTriggerAxis.x));
                EmitAlias(ButtonAlias.Trigger_Touch, true, currentTriggerAxis.x, ref triggerTouched);
            }
            else if (VRTK_SDK_Bridge.IsTriggerTouchedUpOnIndex(controllerIndex))
            {
                OnTriggerTouchEnd(SetButtonEvent(ref triggerTouched, false, 0f));
                EmitAlias(ButtonAlias.Trigger_Touch, false, 0f, ref triggerTouched);
            }

            //Trigger Hairline
            if (VRTK_SDK_Bridge.IsHairTriggerDownOnIndex(controllerIndex))
            {
                OnTriggerHairlineStart(SetButtonEvent(ref triggerHairlinePressed, true, currentTriggerAxis.x));
                EmitAlias(ButtonAlias.Trigger_Hairline, true, currentTriggerAxis.x, ref triggerHairlinePressed);
            }
            else if (VRTK_SDK_Bridge.IsHairTriggerUpOnIndex(controllerIndex))
            {
                OnTriggerHairlineEnd(SetButtonEvent(ref triggerHairlinePressed, false, 0f));
                EmitAlias(ButtonAlias.Trigger_Hairline, false, 0f, ref triggerHairlinePressed);
            }

            //Trigger Clicked
            if (!triggerClicked && currentTriggerAxis.x >= triggerClickThreshold)
            {
                OnTriggerClicked(SetButtonEvent(ref triggerClicked, true, currentTriggerAxis.x));
                EmitAlias(ButtonAlias.Trigger_Click, true, currentTriggerAxis.x, ref triggerClicked);
            }
            else if (triggerClicked && currentTriggerAxis.x < triggerClickThreshold)
            {
                OnTriggerUnclicked(SetButtonEvent(ref triggerClicked, false, 0f));
                EmitAlias(ButtonAlias.Trigger_Click, false, 0f, ref triggerClicked);
            }

            //Trigger Axis
            if (Vector2ShallowEquals(triggerAxis, currentTriggerAxis))
            {
                triggerAxisChanged = false;
            }
            else
            {
                OnTriggerAxisChanged(SetButtonEvent(ref triggerAxisChanged, true, currentTriggerAxis.x));
            }

            //ApplicationMenu
            if (VRTK_SDK_Bridge.IsApplicationMenuPressedDownOnIndex(controllerIndex))
            {
                OnApplicationMenuPressed(SetButtonEvent(ref applicationMenuPressed, true, 1f));
                EmitAlias(ButtonAlias.Application_Menu, true, 1f, ref applicationMenuPressed);
            }
            else if (VRTK_SDK_Bridge.IsApplicationMenuPressedUpOnIndex(controllerIndex))
            {
                OnApplicationMenuReleased(SetButtonEvent(ref applicationMenuPressed, false, 0f));
                EmitAlias(ButtonAlias.Application_Menu, false, 0f, ref applicationMenuPressed);
            }

            //Grip
            if (VRTK_SDK_Bridge.IsGripPressedDownOnIndex(controllerIndex))
            {
                OnGripPressed(SetButtonEvent(ref gripPressed, true, 1f));
                EmitAlias(ButtonAlias.Grip, true, 1f, ref gripPressed);
            }
            else if (VRTK_SDK_Bridge.IsGripPressedUpOnIndex(controllerIndex))
            {
                OnGripReleased(SetButtonEvent(ref gripPressed, false, 0f));
                EmitAlias(ButtonAlias.Grip, false, 0f, ref gripPressed);
            }

            //Touchpad Pressed
            if (VRTK_SDK_Bridge.IsTouchpadPressedDownOnIndex(controllerIndex))
            {
                OnTouchpadPressed(SetButtonEvent(ref touchpadPressed, true, 1f));
                EmitAlias(ButtonAlias.Touchpad_Press, true, 1f, ref touchpadPressed);
            }
            else if (VRTK_SDK_Bridge.IsTouchpadPressedUpOnIndex(controllerIndex))
            {
                OnTouchpadReleased(SetButtonEvent(ref touchpadPressed, false, 0f));
                EmitAlias(ButtonAlias.Touchpad_Press, false, 0f, ref touchpadPressed);
            }

            //Touchpad Touched
            if (VRTK_SDK_Bridge.IsTouchpadTouchedDownOnIndex(controllerIndex))
            {
                OnTouchpadTouchStart(SetButtonEvent(ref touchpadTouched, true, 1f));
                EmitAlias(ButtonAlias.Touchpad_Touch, true, 1f, ref touchpadTouched);
            }
            else if (VRTK_SDK_Bridge.IsTouchpadTouchedUpOnIndex(controllerIndex))
            {
                OnTouchpadTouchEnd(SetButtonEvent(ref touchpadTouched, false, 0f));
                EmitAlias(ButtonAlias.Touchpad_Touch, false, 0f, ref touchpadTouched);
            }

            if (Vector2ShallowEquals(touchpadAxis, currentTouchpadAxis))
            {
                touchpadAxisChanged = false;
            }
            else
            {
                OnTouchpadAxisChanged(SetButtonEvent(ref touchpadTouched, true, 1f));
                touchpadAxisChanged = true;
            }

            // Save current touch and trigger settings to detect next change.
            touchpadAxis     = new Vector2(currentTouchpadAxis.x, currentTouchpadAxis.y);
            triggerAxis      = new Vector2(currentTriggerAxis.x, currentTriggerAxis.y);
            hairTriggerDelta = VRTK_SDK_Bridge.GetTriggerHairlineDeltaOnIndex(controllerIndex);
        }
Ejemplo n.º 13
0
 protected virtual void Awake()
 {
     playArea = VRTK_DeviceFinder.PlayAreaTransform();
 }
Ejemplo n.º 14
0
 protected virtual void SetControlledObject()
 {
     setControlOverrideObject      = controlOverrideObject;
     controlledGameObject          = (controlOverrideObject ? controlOverrideObject : VRTK_DeviceFinder.PlayAreaTransform().gameObject);
     controlledGameObjectPreviousY = controlledGameObject.transform.position.y;
 }
Ejemplo n.º 15
0
 protected virtual void ManageControllerModelListeners(bool register)
 {
     ManageControllerModelListener(register, VRTK_DeviceFinder.GetControllerHand(gameObject));
 }
Ejemplo n.º 16
0
 public abstract string GetControllerElementPath(ControllerElelements element, VRTK_DeviceFinder.ControllerHand hand);
Ejemplo n.º 17
0
 public static string GetControllerElementPath(SDK_Base.ControllerElelements element, VRTK_DeviceFinder.ControllerHand hand = VRTK_DeviceFinder.ControllerHand.Right)
 {
     return GetActiveSDK().GetControllerElementPath(element, hand);
 }
Ejemplo n.º 18
0
 protected override void OnEnable()
 {
     base.OnEnable();
     headset = VRTK_DeviceFinder.HeadsetTransform();
 }
Ejemplo n.º 19
0
        protected virtual void OnEnable()
        {
            InitListeners(true);

            playArea = VRTK_DeviceFinder.PlayAreaTransform();
        }
Ejemplo n.º 20
0
 private void InitListeners(bool state)
 {
     InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state);
     InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state);
 }
Ejemplo n.º 21
0
 protected void InitControllerListeners(bool state)
 {
     InitControllerListener(state, VRTK_DeviceFinder.GetControllerLeftHand(), ref leftControllerEvents, ref leftControllerGrab, LeftButtonPressed, LeftButtonReleased);
     InitControllerListener(state, VRTK_DeviceFinder.GetControllerRightHand(), ref rightControllerEvents, ref rightControllerGrab, RightButtonPressed, RightButtonReleased);
 }
Ejemplo n.º 22
0
        private void DisableEvents()
        {
            if (triggerPressed)
            {
                OnTriggerReleased(SetButtonEvent(ref triggerPressed, false, 0f));
                EmitAlias(ButtonAlias.Trigger_Press, false, 0f, ref triggerPressed);
            }

            if (triggerTouched)
            {
                OnTriggerTouchEnd(SetButtonEvent(ref triggerTouched, false, 0f));
                EmitAlias(ButtonAlias.Trigger_Touch, false, 0f, ref triggerTouched);
            }

            if (triggerHairlinePressed)
            {
                OnTriggerHairlineEnd(SetButtonEvent(ref triggerHairlinePressed, false, 0f));
                EmitAlias(ButtonAlias.Trigger_Hairline, false, 0f, ref triggerHairlinePressed);
            }

            if (triggerClicked)
            {
                OnTriggerUnclicked(SetButtonEvent(ref triggerClicked, false, 0f));
                EmitAlias(ButtonAlias.Trigger_Click, false, 0f, ref triggerClicked);
            }

            if (applicationMenuPressed)
            {
                OnApplicationMenuReleased(SetButtonEvent(ref applicationMenuPressed, false, 0f));
                EmitAlias(ButtonAlias.Application_Menu, false, 0f, ref applicationMenuPressed);
            }

            if (gripPressed)
            {
                OnGripReleased(SetButtonEvent(ref gripPressed, false, 0f));
                EmitAlias(ButtonAlias.Grip, false, 0f, ref gripPressed);
            }

            if (touchpadPressed)
            {
                OnTouchpadReleased(SetButtonEvent(ref touchpadPressed, false, 0f));
                EmitAlias(ButtonAlias.Touchpad_Press, false, 0f, ref touchpadPressed);
            }

            if (touchpadTouched)
            {
                OnTouchpadTouchEnd(SetButtonEvent(ref touchpadTouched, false, 0f));
                EmitAlias(ButtonAlias.Touchpad_Touch, false, 0f, ref touchpadTouched);
            }

            triggerAxisChanged  = false;
            touchpadAxisChanged = false;

            controllerIndex = VRTK_DeviceFinder.GetControllerIndex(gameObject);
            if (controllerIndex < uint.MaxValue)
            {
                Vector2 currentTriggerAxis  = VRTK_SDK_Bridge.GetTriggerAxisOnIndex(controllerIndex);
                Vector2 currentTouchpadAxis = VRTK_SDK_Bridge.GetTouchpadAxisOnIndex(controllerIndex);

                // Save current touch and trigger settings to detect next change.
                touchpadAxis     = new Vector2(currentTouchpadAxis.x, currentTouchpadAxis.y);
                triggerAxis      = new Vector2(currentTriggerAxis.x, currentTriggerAxis.y);
                hairTriggerDelta = VRTK_SDK_Bridge.GetTriggerHairlineDeltaOnIndex(controllerIndex);
            }
        }
Ejemplo n.º 23
0
 protected virtual void OnEnable()
 {
     modelContainer = (!modelContainer ? VRTK_DeviceFinder.GetModelAliasController(gameObject) : modelContainer);
     StartCoroutine(WaitForModel());
 }
Ejemplo n.º 24
0
        // Token: 0x06001845 RID: 6213 RVA: 0x00080FF4 File Offset: 0x0007F1F4
        protected override VRTK_ObjectControl GetOtherControl()
        {
            GameObject gameObject = VRTK_DeviceFinder.IsControllerLeftHand(base.gameObject) ? VRTK_DeviceFinder.GetControllerRightHand(false) : VRTK_DeviceFinder.GetControllerLeftHand(false);

            if (gameObject)
            {
                return(gameObject.GetComponent <VRTK_TouchpadControl>());
            }
            return(null);
        }
 protected virtual void ToggleOnHeadset()
 {
     if (headsetType != SDK_BaseHeadset.HeadsetType.Undefined && headsetType == VRTK_DeviceFinder.GetHeadsetType())
     {
         ToggleObject();
     }
 }
Ejemplo n.º 26
0
 private void DisableBodyPhysics()
 {
     DestroyCollider();
     InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), false);
     InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), false);
 }
Ejemplo n.º 27
0
 protected virtual void OnEnable()
 {
     playerHead = (headOverride != null ? headOverride : VRTK_DeviceFinder.HeadsetTransform());
 }
Ejemplo n.º 28
0
 public static Vector3 GetControllerAngularVelocity(GameObject givenController)
 {
     return(VRTK_DeviceFinder.GetControllerAngularVelocity(VRTK_ControllerReference.GetControllerReference(givenController)));
 }
Ejemplo n.º 29
0
 // Token: 0x060011B3 RID: 4531 RVA: 0x00066B27 File Offset: 0x00064D27
 public virtual void Initialize(VRTK_ControllerEvents events)
 {
     this.controllerEvents = events;
     this.playArea         = VRTK_DeviceFinder.PlayAreaTransform();
     this.headset          = VRTK_DeviceFinder.HeadsetTransform();
 }
Ejemplo n.º 30
0
 protected GameObject GetControllerModelFromController(GameObject controller)
 {
     return(GetControllerModel(VRTK_DeviceFinder.GetControllerHand(controller)));
 }
Ejemplo n.º 31
0
 protected virtual void Awake()
 {
     destroyColliderOnDisable = false;
     SDK_BaseController.ControllerHand controllerHand = VRTK_DeviceFinder.GetControllerHand(gameObject);
     defaultColliderPrefab = Resources.Load(VRTK_SDK_Bridge.GetControllerDefaultColliderPath(controllerHand));
 }
Ejemplo n.º 32
0
        private void SetControllerAttachPoint()
        {
            //If no attach point has been specified then just use the tip of the controller
            if (controllerAttachPoint == null)
            {
                //attempt to find the attach point on the controller
                var defaultAttachPoint = transform.Find(VRTK_SDK_Bridge.GetControllerElementPath(SDK_Base.ControllerElelements.AttachPoint, VRTK_DeviceFinder.GetControllerHand(gameObject)));
                if (defaultAttachPoint != null)
                {
                    controllerAttachPoint = defaultAttachPoint.GetComponent <Rigidbody>();

                    if (controllerAttachPoint == null)
                    {
                        var autoGenRB = defaultAttachPoint.gameObject.AddComponent <Rigidbody>();
                        autoGenRB.isKinematic = true;
                        controllerAttachPoint = autoGenRB;
                    }
                }
            }
        }
Ejemplo n.º 33
0
        protected virtual VRTK_UIPointer GetPointer(PointerEventData eventData)
        {
            GameObject controller = VRTK_DeviceFinder.GetControllerByIndex((uint)eventData.pointerId, false);

            return(controller != null ? controller.GetComponent <VRTK_UIPointer>() : null);
        }