public void Start() { // Disable the hand and gaze ray, we don't want then for this demo and the conflict // with the visuals PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOff); PointerUtils.SetHandRayPointerBehavior(PointerBehavior.AlwaysOff); }
/// <summary> /// Sets pointer behavior to mimic HoloLens 2 /// PokePointer will be Default /// GrabPointer will be Default /// HandRayPointer will be Default /// MotionControllerRayPointer will be off /// GazePointer will be Off /// </summary> public void SetHoloLens2() { PointerUtils.SetHandPokePointerBehavior(PointerBehavior.Default, Handedness.Any); PointerUtils.SetHandGrabPointerBehavior(PointerBehavior.Default, Handedness.Any); PointerUtils.SetHandRayPointerBehavior(PointerBehavior.Default, Handedness.Any); PointerUtils.SetMotionControllerRayPointerBehavior(PointerBehavior.AlwaysOff, Handedness.Any); PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOff); }
//private Dictionary<System.Guid, ScanContext> scanContextMap = new Dictionary<System.Guid, ScanContext>(); // we may use a dictionary to store many scans waiting for results ... let's start with one for now // Use this for initialization void Start() { angleRadian = horizontalAngle * (Math.PI / 180); gaze = CoreServices.InputSystem.GazeProvider; cursor?.SetActive(false);//disable cursor shutterSound = GetComponent <AudioSource>() as AudioSource; labeler = GetComponent <ObjectLabeler>() as ObjectLabeler; mqttHelper = GetComponent <MqttHelper>() as MqttHelper; mqttHelper.Subscribe(ResultReceiver); // Debug.Log("File path " + Application.persistentDataPath); // take lower resolution available if ((PhotoCapture.SupportedResolutions != null) && (PhotoCapture.SupportedResolutions.Count() > 0)) { cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).Last(); ratio = (float)cameraResolution.height / (float)cameraResolution.width; Debug.Log("Resolution " + cameraResolution.height + " x " + cameraResolution.width); } else { ratio = 9f / 16f; } scanContext = new ScanContext(horizontalAngle, ratio, Camera.main.transform); // create a context with Camera position. ScannerScreen.SetActive(false); // remove the scanner Vector3 scale = ScannerScreen.transform.localScale; scale.x = 2f * scannerScreenDistance * (float)Math.Tan(angleRadian / 2f); scale.y = scale.x * ratio; // scale the entire photo on height ScannerScreen.transform.localScale = scale; Debug.Log("scanContext init " + scanContext.ToString()); // Create a PhotoCapture object PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject) { photoCaptureObject = captureObject; CameraParameters cameraParameters = new CameraParameters(); cameraParameters.hologramOpacity = 0.0f; cameraParameters.cameraResolutionWidth = cameraResolution.width; cameraParameters.cameraResolutionHeight = cameraResolution.height; cameraParameters.pixelFormat = CapturePixelFormat.BGRA32; //cameraParameters.pixelFormat = showPicture == true ? CapturePixelFormat.BGRA32 : CapturePixelFormat.JPEG; photoCaptureObject.StartPhotoModeAsync(cameraParameters, delegate(PhotoCapture.PhotoCaptureResult result) { // Take a picture Debug.Log("camera ready to take picture"); }); }); PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOn); }
private async void Start() { if (debug) { Utils.setDebugMode(true, true); } _logger = MixedRealityToolkit.Instance.GetService <ILoggingService>().GetLogger(); Assert.IsNotNull(_logger, "_logger != null"); _videoDisplayManager = GetComponent <VideoDisplayManager>(); Assert.IsNotNull(_videoDisplayManager, "VideoDisplayManager != null"); _visualizationManager = GetComponent <VisualizationManager>(); Assert.IsNotNull(_visualizationManager, "_visualizationManager != null"); _cameraService = MixedRealityToolkit.Instance.GetService <ICameraService>(); _objectTrackingService = MixedRealityToolkit.Instance.GetService <IObjectTrackingService>(); _objectDetectionService = MixedRealityToolkit.Instance.GetService <IObjectDetectionService>(); maxConcurrentRequestsSlider.OnValueUpdated.AddListener(OnMaxConcurrentRequestUpdated); maxConcurrentRequestsSlider.SliderValue = _objectDetectionService.maxConcurrentRequests / 20.0f; fixedTrackerCountSlider.OnValueUpdated.AddListener(OnFixedTrackerCountUpdated); fixedTrackerCountSlider.SliderValue = _objectTrackingService.FixedTrackerCount / 20.0f; minimalPredictionProbabilitySlider.OnValueUpdated.AddListener(OnMinimalPredictionProbabilityUpdated); fixedTrackerCountSlider.SliderValue = (float)_objectDetectionService.minimalPredictionProbability; forceFixedTrackerCountSwitch.OnClick.AddListener(OnFixedTrackerCountToggled); forceFixedTrackerCountSwitch.IsToggled = _objectTrackingService.ForceFixedTrackerCount; detectOnRepeatSwitch.OnClick.AddListener(OnDetectOnRepeatToggled); detectOnRepeatSwitch.IsToggled = _objectDetectionService.detectOnRepeat; processFrameSync.OnClick.AddListener(OnProcessFrameSyncToggled); processFrameSync.IsToggled = sync; PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOn); await StartFrameReaderAsync(); _status = Status.Running; }
public IEnumerator TestGaze() { PointerStateContainer gazeOn = new PointerStateContainer() { GazePointerEnabled = true, GGVPointerEnabled = true, PokePointerEnabled = null, SpherePointerEnabled = null, LinePointerEnabled = null }; // set input simulation mode to GGV PlayModeTestUtilities.SetControllerSimulationMode(ControllerSimulationMode.HandGestures); TestHand rightHand = new TestHand(Handedness.Right); TestHand leftHand = new TestHand(Handedness.Left); TestContext.Out.WriteLine("Show both hands"); yield return(rightHand.Show(Vector3.zero)); yield return(leftHand.Show(Vector3.zero)); EnsurePointerStates(Handedness.Right, gazeOn); EnsurePointerStates(Handedness.Left, gazeOn); TestContext.Out.WriteLine("Turn off gaze cursor"); PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOff); yield return(null); PointerStateContainer gazeOff = new PointerStateContainer() { GazePointerEnabled = false, GGVPointerEnabled = false, PokePointerEnabled = null, SpherePointerEnabled = null, LinePointerEnabled = null }; EnsurePointerStates(Handedness.Right, gazeOff); EnsurePointerStates(Handedness.Left, gazeOff); }
/// <summary> /// Sets the <see cref="Microsoft.MixedReality.Toolkit.Input.PointerBehavior"/> for the gaze pointer to be AlwaysOff /// <param name="isEnabled">If true, behavior will be set to Default. /// Otherwise it will be set to AlwaysOff</param> /// </summary> public void SetGazeEnabled(bool isEnabled) { PointerUtils.SetGazePointerBehavior(isEnabled ? PointerBehavior.Default : PointerBehavior.AlwaysOff); }
/// <summary> /// ゲイズポインターをOffにする /// </summary> public void GazePointerOff() { PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOff); }