protected virtual void OnEnable() { GameObject actualController = VRTK_DeviceFinder.GetActualController(gameObject); trackedController = (actualController != null ? actualController.GetComponent <VRTK_TrackedController>() : GetComponent <VRTK_TrackedController>()); Update(); }
private void SetTrackedControllerCaches(bool forceRefresh = false) { if (forceRefresh) { cachedLeftController = null; cachedRightController = null; } var sdkManager = VRTK_SDKManager.instance; if (sdkManager != null) { if (cachedLeftController == null && sdkManager.actualLeftController) { cachedLeftController = sdkManager.actualLeftController.GetComponent <VRTK_TrackedController>(); cachedLeftController.index = 0; } if (cachedRightController == null && sdkManager.actualRightController) { cachedRightController = sdkManager.actualRightController.GetComponent <VRTK_TrackedController>(); cachedRightController.index = 1; } } SetFloorLevel(); }
protected virtual void InitListeners() { if (controllerEvents != null) { controllerEvents.ControllerEnabled += DoControllerEnabled; controllerEvents.ControllerVisible += DoControllerVisible; controllerEvents.ControllerHidden += DoControllerInvisible; controllerEvents.ControllerModelAvailable += DoControllerModelAvailable; } else { trackedController = GetComponentInParent <VRTK_TrackedController>(); if (trackedController != null) { trackedController.ControllerModelAvailable += TrackedControllerDoControllerModelAvailable; } } headsetControllerAware = (headsetControllerAware != null ? headsetControllerAware : FindObjectOfType <VRTK_HeadsetControllerAware>()); if (headsetControllerAware != null) { headsetControllerAware.ControllerGlanceEnter += DoGlanceEnterController; headsetControllerAware.ControllerGlanceExit += DoGlanceExitController; ToggleTips(false); } }
protected virtual void OnEnable() { var actualController = VRTK_DeviceFinder.GetActualController(gameObject); if (actualController) { trackedController = actualController.GetComponent <VRTK_TrackedController>(); } }
protected virtual void OnEnable() { destroyColliderOnDisable = false; VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Controller); CreateTouchRigidBody(); trackedController = GetComponentInParent <VRTK_TrackedController>(); if (trackedController != null) { trackedController.ControllerModelAvailable += DoControllerModelAvailable; } }
protected virtual void SetControllerIndex(ref VRTK_TrackedController trackedController) { if (trackedController != null) { SDK_UnityControllerTracker tracker = trackedController.GetComponent <SDK_UnityControllerTracker>(); if (tracker != null) { trackedController.index = tracker.index; } } }
private VRTK_TrackedController GetTrackedObject(GameObject controller) { SetTrackedControllerCaches(); VRTK_TrackedController trackedObject = null; if (IsControllerLeftHand(controller)) { trackedObject = cachedLeftController; } else if (IsControllerRightHand(controller)) { trackedObject = cachedRightController; } return(trackedObject); }
protected virtual void SetTrackedControllerCaches(bool forceRefresh = false) { if (settingCaches) { return; } settingCaches = true; if (forceRefresh) { cachedLeftController = null; cachedRightController = null; } VRTK_SDKManager sdkManager = VRTK_SDKManager.instance; if (sdkManager != null && sdkManager.loadedSetup != null) { if (cachedLeftController == null && sdkManager.loadedSetup.actualLeftController != null) { cachedLeftController = sdkManager.loadedSetup.actualLeftController.GetComponent <VRTK_TrackedController>(); SetControllerIndex(ref cachedLeftController); if (cachedLeftController != null) { cachedLeftTracker = cachedLeftController.GetComponent <SDK_UnityControllerTracker>(); cachedLeftVelocityEstimator = cachedLeftController.GetComponent <VRTK_VelocityEstimator>(); SetControllerButtons(ControllerHand.Left); } } if (cachedRightController == null && sdkManager.loadedSetup.actualRightController != null) { cachedRightController = sdkManager.loadedSetup.actualRightController.GetComponent <VRTK_TrackedController>(); SetControllerIndex(ref cachedRightController); if (cachedRightController != null) { cachedRightTracker = cachedRightController.GetComponent <SDK_UnityControllerTracker>(); cachedRightVelocityEstimator = cachedRightController.GetComponent <VRTK_VelocityEstimator>(); SetControllerButtons(ControllerHand.Right); } } } settingCaches = false; }
protected virtual void OnEnable() { controllerAlias = originalControllerAlias; if (controllerAlias == null) { VRTK_TrackedController trackedController = GetComponentInParent <VRTK_TrackedController>(); controllerAlias = (trackedController != null ? trackedController.gameObject : null); } if (controllerAlias == null) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, "VRTK_ControllerHighlighter", "Controller Alias GameObject", "controllerAlias", "the same")); return; } ConfigureControllerPaths(); modelContainer = (modelContainer != null ? modelContainer : VRTK_DeviceFinder.GetModelAliasController(controllerAlias)); initHighlightersRoutine = StartCoroutine(WaitForModel()); }
protected virtual void OnEnable() { scriptControllerAlias = (controllerAlias != null ? controllerAlias : gameObject); actualController = VRTK_DeviceFinder.GetActualController(scriptControllerAlias); if (actualController != null) { trackedController = actualController.GetComponent <VRTK_TrackedController>(); if (trackedController != null) { trackedController.ControllerModelAvailable += DoControllerModelAvailable; } if (trackedControllerReady) { ControllerAvailable(); } } else { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, "VRTK_ControllerHighlighter", "Controller Alias GameObject", "controllerAlias", "the same")); } }
// Token: 0x0600153E RID: 5438 RVA: 0x0007532C File Offset: 0x0007352C protected virtual void OnEnable() { this.controllerAlias = this.originalControllerAlias; if (this.controllerAlias == null) { VRTK_TrackedController componentInParent = base.GetComponentInParent <VRTK_TrackedController>(); this.controllerAlias = ((componentInParent != null) ? componentInParent.gameObject : null); } if (this.controllerAlias == null) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_NOT_INJECTED, new object[] { "VRTK_ControllerHighlighter", "Controller Alias GameObject", "controllerAlias", "the same" })); return; } this.ConfigureControllerPaths(); this.modelContainer = ((this.modelContainer != null) ? this.modelContainer : VRTK_DeviceFinder.GetModelAliasController(this.controllerAlias)); this.initHighlightersRoutine = base.StartCoroutine(this.WaitForModel()); }
/// <summary> /// The GetControllerIndex method returns the index of the given controller. /// </summary> /// <param name="controller">The GameObject containing the controller.</param> /// <returns>The index of the given controller.</returns> public override uint GetControllerIndex(GameObject controller) { VRTK_TrackedController trackedObject = GetTrackedObject(controller); return(trackedObject != null ? trackedObject.index : uint.MaxValue); }