public override void DrawInspectorGUI(object target) { IMixedRealityFocusProvider focusProvider = (IMixedRealityFocusProvider)target; EditorGUILayout.LabelField("Active Pointers", EditorStyles.boldLabel); if (!Application.isPlaying) { EditorGUILayout.HelpBox("Pointers will be populated once you enter play mode.", MessageType.Info); return; } bool pointerFound = false; foreach (IMixedRealityPointer pointer in focusProvider.GetPointers <IMixedRealityPointer>()) { GUI.color = pointer.IsInteractionEnabled ? enabledColor : disabledColor; EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField(pointer.PointerName); EditorGUILayout.Toggle("Interaction Enabled", pointer.IsInteractionEnabled); EditorGUILayout.Toggle("Focus Locked", pointer.IsFocusLocked); EditorGUILayout.ObjectField("Focus Result", pointer.Result?.CurrentPointerTarget, typeof(GameObject), true); EditorGUILayout.EndVertical(); pointerFound = true; } if (!pointerFound) { EditorGUILayout.LabelField("(None found)", EditorStyles.miniLabel); } GUI.color = enabledColor; }
/// <summary> /// Constructor. /// </summary> public BaseGlobalInputSource(string name, IMixedRealityFocusProvider focusProvider, InputSourceType sourceType = InputSourceType.Other) { SourceId = (CoreServices.InputSystem != null) ? CoreServices.InputSystem.GenerateNewSourceId() : 0; SourceName = name; FocusProvider = focusProvider; SourceType = sourceType; UpdateActivePointers(); }
/// <summary> /// Resets all cached system references to null /// </summary> public static void ResetCacheReferences() { serviceCache.Clear(); boundarySystem = null; cameraSystem = null; diagnosticsSystem = null; focusProvider = null; inputSystem = null; raycastProvider = null; sceneSystem = null; spatialAwarenessSystem = null; teleportSystem = null; }
public void SetupFocusProviderRaycastTests() { PlayModeTestUtilities.Setup(); focusProvider = PlayModeTestUtilities.GetInputSystem().FocusProvider; pointer = new TestPointer(); focusProvider.RegisterPointer(pointer); GameObject raycastTestPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath("dc3b0cf66c0615e4c81d979f35d51eaa")); raycastTestPrefabInstance = Object.Instantiate(raycastTestPrefab); }
public void SetupFocusProviderRaycastTests() { PlayModeTestUtilities.Setup(); focusProvider = PlayModeTestUtilities.GetInputSystem().FocusProvider; pointer = new TestPointer(); focusProvider.RegisterPointer(pointer); GameObject raycastTestPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(Path.Combine("Assets", "MixedRealityToolkit.Tests", "PlayModeTests", "Prefabs", "FocusProviderRaycastTest.prefab")); raycastTestPrefabInstance = Object.Instantiate(raycastTestPrefab); }
public void ShutdownFocusProviderRaycastTests() { if (raycastTestPrefabInstance) { Object.DestroyImmediate(raycastTestPrefabInstance); raycastTestPrefabInstance = null; } focusProvider.UnregisterPointer(pointer); focusProvider = null; pointer = null; PlayModeTestUtilities.TearDown(); }
public override IEnumerator TearDown() { if (raycastTestPrefabInstance) { Object.DestroyImmediate(raycastTestPrefabInstance); raycastTestPrefabInstance = null; } focusProvider.UnregisterPointer(pointer); focusProvider = null; pointer = null; yield return(base.TearDown()); }
public override IEnumerator Setup() { yield return(base.Setup()); focusProvider = PlayModeTestUtilities.GetInputSystem().FocusProvider; pointer = new TestPointer(); focusProvider.RegisterPointer(pointer); GameObject raycastTestPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath("dc3b0cf66c0615e4c81d979f35d51eaa")); raycastTestPrefabInstance = Object.Instantiate(raycastTestPrefab); yield return(null); }
/// <summary> /// Gets if the associated sphere pointer on this controller is near any grabbable objects. /// </summary> /// <returns>True if associated sphere pointer is near any grabbable objects, else false.</returns> /// <param name="dist">Out parameter gets the distance to the grabbable.</param> protected virtual bool IsNearGrabbableObject() { if (cachedSpherePointer == null || cachedSpherePointer.Controller != Pointer.Controller) { IMixedRealityFocusProvider focusProvider = CoreServices.InputSystem?.FocusProvider; if (focusProvider.IsNotNull()) { var spherePointers = focusProvider.GetPointers <SpherePointer>(); foreach (var spherePointer in spherePointers) { if (spherePointer.Controller == Pointer.Controller) { cachedSpherePointer = spherePointer; break; } } } } return(cachedSpherePointer != null && cachedSpherePointer.IsNearObject); }
private static void ResetCacheReferenceFromType(Type serviceType) { if (typeof(IMixedRealityBoundarySystem).IsAssignableFrom(serviceType)) { boundarySystem = null; } else if (typeof(IMixedRealityCameraSystem).IsAssignableFrom(serviceType)) { cameraSystem = null; } else if (typeof(IMixedRealityDiagnosticsSystem).IsAssignableFrom(serviceType)) { diagnosticsSystem = null; } else if (typeof(IMixedRealityFocusProvider).IsAssignableFrom(serviceType)) { focusProvider = null; } else if (typeof(IMixedRealityInputSystem).IsAssignableFrom(serviceType)) { inputSystem = null; } else if (typeof(IMixedRealityRaycastProvider).IsAssignableFrom(serviceType)) { raycastProvider = null; } else if (typeof(IMixedRealitySceneSystem).IsAssignableFrom(serviceType)) { sceneSystem = null; } else if (typeof(IMixedRealitySpatialAwarenessSystem).IsAssignableFrom(serviceType)) { sceneSystem = null; } else if (typeof(IMixedRealityTeleportSystem).IsAssignableFrom(serviceType)) { teleportSystem = null; } }