Class FocusProvider
The focus provider handles the focused objects per input source.
Implements
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.Input
Assembly: cs.temp.dll.dll
Syntax
public class FocusProvider : BaseCoreSystem, IMixedRealityServiceState, IMixedRealityEventSystem, IMixedRealityFocusProvider, IMixedRealityService, IDisposable, IMixedRealitySourceStateHandler, IMixedRealitySpeechHandler, IMixedRealityBaseInputHandler, IEventSystemHandler, IPointerPreferences
Remarks
There are convenience properties for getting only Gaze Pointer if needed.
Constructors
FocusProvider(IMixedRealityServiceRegistrar, MixedRealityInputSystemProfile)
Constructor.
Declaration
[Obsolete("This constructor is obsolete (registrar parameter is no longer required) and will be removed in a future version of the Microsoft Mixed Reality Toolkit.")]
public FocusProvider(IMixedRealityServiceRegistrar registrar, MixedRealityInputSystemProfile profile)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityServiceRegistrar | registrar | The IMixedRealityServiceRegistrar instance that loaded the service. |
MixedRealityInputSystemProfile | profile | The configuration profile for the service. |
FocusProvider(MixedRealityInputSystemProfile)
Constructor.
Declaration
public FocusProvider(MixedRealityInputSystemProfile profile)
Parameters
Type | Name | Description |
---|---|---|
MixedRealityInputSystemProfile | profile | The configuration profile for the service. |
Properties
FocusLayerMasks
The layer masks for the focus pointers to raycast against.
Declaration
public LayerMask[] FocusLayerMasks { get; }
Property Value
Type | Description |
---|---|
LayerMask[] |
GazePointerBehavior
Pointer behavior for the gaze pointer. We make gaze pointer unique because the internal gaze pointer actually cannot be referenced from here since it's an internal class.
Declaration
public PointerBehavior GazePointerBehavior { get; set; }
Property Value
Type | Description |
---|---|
PointerBehavior |
Name
Optional Priority attribute if multiple services of the same type are required, enables targeting a service for action.
Declaration
public override string Name { get; protected set; }
Property Value
Type | Description |
---|---|
String |
Overrides
NumFarPointersActive
The number of pointers that support far interaction (like motion controller rays, hand rays) that are active (IsInteractionEnabled == true), excluding the gaze cursor
Declaration
public int NumFarPointersActive { get; }
Property Value
Type | Description |
---|---|
Int32 |
NumNearPointersActive
Number of IMixedRealityNearPointers that are active (IsInteractionEnabled == true).
Declaration
public int NumNearPointersActive { get; }
Property Value
Type | Description |
---|---|
Int32 |
PointerMediators
Declaration
public IReadOnlyDictionary<uint, IMixedRealityPointerMediator> PointerMediators { get; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<UInt32, IMixedRealityPointerMediator> |
PrimaryPointer
Declaration
public IMixedRealityPointer PrimaryPointer { get; }
Property Value
Type | Description |
---|---|
IMixedRealityPointer |
Priority
Optional Priority to reorder registered managers based on their respective priority, reduces the risk of race conditions by prioritizing the order in which managers are evaluated.
Declaration
public override uint Priority { get; }
Property Value
Type | Description |
---|---|
UInt32 |
Overrides
UIRaycastCamera
The Camera the EventSystem uses to raycast against.
Declaration
public Camera UIRaycastCamera { get; }
Property Value
Type | Description |
---|---|
Camera |
Remarks
Every uGUI canvas in your scene should use this camera as its event camera.
Methods
Destroy()
Optional Destroy function to perform cleanup of the service before the Mixed Reality Toolkit is destroyed.
Declaration
public override void Destroy()
Overrides
GenerateNewPointerId()
Generate a new unique pointer id.
Declaration
public uint GenerateNewPointerId()
Returns
Type | Description |
---|---|
UInt32 |
GetFocusedObject(IMixedRealityPointer)
Gets the currently focused object for the pointing source.
Declaration
public GameObject GetFocusedObject(IMixedRealityPointer pointingSource)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityPointer | pointingSource |
Returns
Type | Description |
---|---|
GameObject | Currently Focused Object. |
Remarks
If the pointing source is not registered, then the Gaze's Focused GameObject is returned.
GetPointerBehavior(IMixedRealityPointer)
Gets the PointerBehavior for a given pointer
Declaration
public PointerBehavior GetPointerBehavior(IMixedRealityPointer pointer)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityPointer | pointer |
Returns
Type | Description |
---|---|
PointerBehavior |
GetPointerBehavior<T>(Handedness, InputSourceType)
Gets the behavior for the given pointer type.
Declaration
public PointerBehavior GetPointerBehavior<T>(Handedness handedness, InputSourceType sourceType)
where T : class, IMixedRealityPointer
Parameters
Type | Name | Description |
---|---|---|
Handedness | handedness | Handedness to query |
InputSourceType | sourceType |
Returns
Type | Description |
---|---|
PointerBehavior | PointerBehavior for the given pointer type and handedness. If right hand is enabled, left hand is not enabled, and Handedness.Any is passed, returns value for the right hand. |
Type Parameters
Name | Description |
---|---|
T |
GetPointers<T>()
Provides access to all registered pointers of a specified type.
Declaration
public IEnumerable<T> GetPointers<T>()
where T : class, IMixedRealityPointer
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T | The type of pointers to request. Use IMixedRealityPointer to access all pointers. |
Initialize()
The initialize function is used to setup the service once created. This method is called once all services have been registered in the Mixed Reality Toolkit.
Declaration
public override void Initialize()
Overrides
IsPointerRegistered(IMixedRealityPointer)
Checks if the pointer is registered with the Focus Manager.
Declaration
public bool IsPointerRegistered(IMixedRealityPointer pointer)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityPointer | pointer |
Returns
Type | Description |
---|---|
Boolean | True, if registered, otherwise false. |
OnSourceDetected(SourceStateEventData)
Raised when a source is detected.
Declaration
public void OnSourceDetected(SourceStateEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
SourceStateEventData | eventData |
OnSourceLost(SourceStateEventData)
Raised when a source is lost.
Declaration
public void OnSourceLost(SourceStateEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
SourceStateEventData | eventData |
OnSpeechKeywordRecognized(SpeechEventData)
Declaration
public void OnSpeechKeywordRecognized(SpeechEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
SpeechEventData | eventData |
RegisterPointer(IMixedRealityPointer)
Registers the pointer with the Focus Manager.
Declaration
public bool RegisterPointer(IMixedRealityPointer pointer)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityPointer | pointer |
Returns
Type | Description |
---|---|
Boolean | True, if the pointer was registered, false if the pointer was previously registered. |
SetPointerBehavior<T>(Handedness, InputSourceType, PointerBehavior)
Sets the PointerBehavior for a given pointer type, handedness, and input type
Declaration
public void SetPointerBehavior<T>(Handedness handedness, InputSourceType inputType, PointerBehavior pointerBehavior)
where T : class, IMixedRealityPointer
Parameters
Type | Name | Description |
---|---|---|
Handedness | handedness | Specify Handedness.Any to apply to all handedness, or specify a specific handedness to just disable, right, left. |
InputSourceType | inputType | |
PointerBehavior | pointerBehavior |
Type Parameters
Name | Description |
---|---|
T | All pointers that are of this type, or a subclass of this type, will have the given behavior |
SubscribeToPrimaryPointerChanged(PrimaryPointerChangedHandler, Boolean)
Declaration
public void SubscribeToPrimaryPointerChanged(PrimaryPointerChangedHandler handler, bool invokeHandlerWithCurrentPointer)
Parameters
Type | Name | Description |
---|---|---|
PrimaryPointerChangedHandler | handler | |
Boolean | invokeHandlerWithCurrentPointer |
TryGetFocusDetails(IMixedRealityPointer, out FocusDetails)
Gets the currently focused object for the pointing source.
Declaration
public bool TryGetFocusDetails(IMixedRealityPointer pointer, out FocusDetails focusDetails)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityPointer | pointer | |
FocusDetails | focusDetails |
Returns
Type | Description |
---|---|
Boolean |
TryOverrideFocusDetails(IMixedRealityPointer, FocusDetails)
Sets the FocusDetails of the specified pointer, overriding the focus point that was currently set. This can be used to change the FocusDetails of a specific pointer even if focus is locked.
Declaration
public bool TryOverrideFocusDetails(IMixedRealityPointer pointer, FocusDetails focusDetails)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityPointer | pointer | |
FocusDetails | focusDetails |
Returns
Type | Description |
---|---|
Boolean | True if the FocusDetails were set successfully. False if the pointer is not associated with the FocusProvider. |
UnregisterPointer(IMixedRealityPointer)
Unregisters the pointer with the Focus Manager.
Declaration
public bool UnregisterPointer(IMixedRealityPointer pointer)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityPointer | pointer |
Returns
Type | Description |
---|---|
Boolean | True, if the pointer was unregistered, false if the pointer was not registered. |
UnsubscribeFromPrimaryPointerChanged(PrimaryPointerChangedHandler)
Declaration
public void UnsubscribeFromPrimaryPointerChanged(PrimaryPointerChangedHandler handler)
Parameters
Type | Name | Description |
---|---|---|
PrimaryPointerChangedHandler | handler |
Update()
Optional Update function to perform per-frame updates of the service.
Declaration
public override void Update()
Overrides
Explicit Interface Implementations
IMixedRealityFocusProvider.GlobalPointingExtent
Maximum distance at which all pointers can collide with a GameObject, unless it has an override extent.
Declaration
float IMixedRealityFocusProvider.GlobalPointingExtent { get; }
Returns
Type | Description |
---|---|
Single |