private void TurnOnBeam(uint index) { beamEnabledState++; if (enabled && !isActive && CanActivate()) { if (playAreaCursor) { playAreaCursor.SetPlayAreaCursorCollision(false); } controllerIndex = index; TogglePointer(true); isActive = true; destinationSetActive = true; if (pointerOriginTransformFollowGameObject != null) { pointerOriginTransformFollowGameObject.SetActive(true); pointerOriginTransformFollow.Follow(); } } }
protected virtual void ConfigureForCurrentSDKSetup() { if (headsetCameraCopy != null) { Destroy(headsetCameraCopy.gameObject); } headsetCameraTransformFollow.enabled = false; followScript.enabled = false; if (VRTK_SDKManager.GetLoadedSDKSetup() == null) { return; } Camera headsetCamera = VRTK_DeviceFinder.HeadsetCamera().GetComponent <Camera>(); desktopCamera.depth = headsetCamera.depth + 1; desktopCamera.stereoTargetEye = StereoTargetEyeMask.None; followScript.gameObjectToFollow = headsetCamera.gameObject; followScript.gameObjectToChange = desktopCamera.gameObject; followScript.Follow(); followScript.enabled = true; if (headsetImage == null) { return; } if (headsetRenderTexture == null) { headsetRenderTexture = new RenderTexture( (int)headsetImage.rectTransform.rect.width, (int)headsetImage.rectTransform.rect.height, 24, RenderTextureFormat.ARGB32) { name = VRTK_SharedMethods.GenerateVRTKObjectName(true, "Headset RenderTexture") }; } headsetCameraCopy = Instantiate(headsetCamera, transform); headsetCameraCopy.name = VRTK_SharedMethods.GenerateVRTKObjectName(true, "Headset Camera Copy"); headsetCameraCopy.targetTexture = headsetRenderTexture; foreach (Transform child in headsetCameraCopy.transform) { Destroy(child.gameObject); } IEnumerable <Component> componentsToDestroy = headsetCameraCopy .GetComponents <Component>() .Where(component => component != headsetCameraCopy && !(component is Transform)); foreach (Component component in componentsToDestroy) { Destroy(component); } headsetCameraTransformFollow.gameObjectToFollow = headsetCamera.gameObject; headsetCameraTransformFollow.gameObjectToChange = headsetCameraCopy.gameObject; headsetCameraTransformFollow.Follow(); headsetCameraTransformFollow.enabled = true; headsetImage.texture = headsetRenderTexture; headsetImage.SetNativeSize(); }