Class PokePointer
A near interaction pointer that generates touch events based on touchables in close proximity.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.Input
Assembly: cs.temp.dll.dll
Syntax
public class PokePointer : BaseControllerPointer, IMixedRealityControllerPoseSynchronizer, IMixedRealitySourcePoseHandler, IMixedRealitySourceStateHandler, IMixedRealityInputHandler, IMixedRealityBaseInputHandler, IMixedRealityInputHandler<float>, IMixedRealityInputHandler<Vector2>, IMixedRealityInputHandler<Vector3>, IMixedRealityInputHandler<Quaternion>, IMixedRealityInputHandler<MixedRealityPose>, IEventSystemHandler, IMixedRealityNearPointer, IMixedRealityPointer, IEqualityComparer
Remarks
Reachable Objects are objects with a both a BaseNearInteractionTouchable and a collider within TouchableDistance from the poke pointer (based on OverlapSphere).
If a poke pointer has no CurrentTouchableObjectDown, then it will try to select one from the Reachable Objects based on:
- Layer mask priority: Lower-priority layer masks will only be considered if higher-priority layers don't contain any Reachable Objects.
- Touchable Distance: the closest object in the highest priority layers is selected based on DistanceToTouchable.
- Ray Distance: The object becomes the CurrentTouchableObjectDown once the ray cast distance becomes negative (behind the surface). At this point the OnTouchStarted or OnPointerDown event is raised.
If a poke pointer does have a CurrentTouchableObjectDown it will not consider any other object, until the DistanceToTouchable exceeds the DebounceThreshold (in front of the surface). At this point the active object is cleared and the OnTouchCompleted or OnPointerUp event is raised.
Fields
line
Declaration
protected LineRenderer line
Field Value
Type | Description |
---|---|
LineRenderer |
touchableDistance
Declaration
protected float touchableDistance
Field Value
Type | Description |
---|---|
Single |
triggerInteraction
Declaration
protected QueryTriggerInteraction triggerInteraction
Field Value
Type | Description |
---|---|
QueryTriggerInteraction |
visuals
Declaration
protected GameObject visuals
Field Value
Type | Description |
---|---|
GameObject |
Properties
ClosestProximityTouchable
The closest touchable component that has been detected.
Declaration
public BaseNearInteractionTouchable ClosestProximityTouchable { get; }
Property Value
Type | Description |
---|---|
BaseNearInteractionTouchable |
Remarks
The closest touchable component limits the set of objects which are currently touchable. These are all the game objects in the subtree of the closest touchable component's owner object.
CurrentTouchableObjectDown
The current object that is being touched.
Declaration
public GameObject CurrentTouchableObjectDown { get; }
Property Value
Type | Description |
---|---|
GameObject |
IgnoreCollidersNotInFOV
Whether to ignore colliders that may be near the pointer, but not actually in the visual FOV. This can prevent accidental touches, and will allow hand rays to turn on when you may be near a touchable but cannot see it. Visual FOV is defined by cone centered about display center, radius equal to half display height.
Declaration
public bool IgnoreCollidersNotInFOV { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsInteractionEnabled
Is the pointer active and have the conditions for the interaction been satisfied to enable the interaction?
Declaration
public override bool IsInteractionEnabled { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
IsNearObject
Returns true if the hand is near anything that's grabbable Currently performs a sphere cast in the direction of the hand ray. Currently anything that has a collider is considered "Grabbable" Eventually we need to filter based on things that can respond to grab events.
Declaration
public bool IsNearObject { get; }
Property Value
Type | Description |
---|---|
Boolean |
PokeLayerMasks
The LayerMasks, in prioritized order, that are used to determine the touchable objects.
Declaration
public LayerMask[] PokeLayerMasks { get; }
Property Value
Type | Description |
---|---|
LayerMask[] |
Remarks
Only BaseNearInteractionTouchables in one of the LayerMasks will raise touch events.
PreviousPosition
Declaration
public Vector3 PreviousPosition { get; }
Property Value
Type | Description |
---|---|
Vector3 |
SceneQueryBufferSize
Maximum number of colliders that can be detected in a scene query.
Declaration
public int SceneQueryBufferSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
TouchableDistance
Maximum distance a which a touchable surface can be interacted with.
Declaration
public float TouchableDistance { get; }
Property Value
Type | Description |
---|---|
Single |
TriggerInteraction
Specify whether queries for touchable surfaces hit triggers.
Declaration
public QueryTriggerInteraction TriggerInteraction { get; }
Property Value
Type | Description |
---|---|
QueryTriggerInteraction |
Methods
OnEnable()
Declaration
protected override void OnEnable()
Overrides
OnInputDown(InputEventData)
Input Down updates from Interactions, Keys, or any other simple input.
Declaration
public override void OnInputDown(InputEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
InputEventData | eventData |
Overrides
OnInputUp(InputEventData)
Input Up updates from Interactions, Keys, or any other simple input.
Declaration
public override void OnInputUp(InputEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
InputEventData | eventData |
Overrides
OnPostSceneQuery()
Called after performing the scene query.
Declaration
public override void OnPostSceneQuery()
Overrides
OnPreCurrentPointerTargetChange()
Called during the scene query just before the current pointer target changes.
Declaration
public override void OnPreCurrentPointerTargetChange()
Overrides
OnPreSceneQuery()
Declaration
public override void OnPreSceneQuery()
Overrides
OnSourceDetected(SourceStateEventData)
Raised when a source is detected.
Declaration
public override void OnSourceDetected(SourceStateEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
SourceStateEventData | eventData |
Overrides
OnSourceLost(SourceStateEventData)
Raised when a source is lost.
Declaration
public override void OnSourceLost(SourceStateEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
SourceStateEventData | eventData |
Overrides
OnValidate()
Declaration
protected void OnValidate()
Explicit Interface Implementations
IMixedRealityNearPointer.TryGetDistanceToNearestSurface(out Single)
Near pointers often interact with surfaces.
This method provides a mechanism to get the distance to the closest surface the near pointer is interacting with.
Declaration
bool IMixedRealityNearPointer.TryGetDistanceToNearestSurface(out float distance)
Parameters
Type | Name | Description |
---|---|---|
Single | distance | Out parameter filled with the distance along the surface normal from the surface to the pointer if available, otherwise 0.0f. |
Returns
Type | Description |
---|---|
Boolean | True if a distance was retrieved, false if not. |
IMixedRealityNearPointer.TryGetNearGraspPoint(out Vector3)
For near pointer we may want to draw a tether between the pointer and the object.
The visual grasp point (average of index and thumb) may actually be different from the pointer position (the palm).
This method provides a mechanism to get the visual grasp point.
NOTE: Not all near pointers have a grasp point (for example a poke pointer).
Declaration
bool IMixedRealityNearPointer.TryGetNearGraspPoint(out Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position |
Returns
Type | Description |
---|---|
Boolean | True if a grasp point was retrieved, false if not. |
IMixedRealityNearPointer.TryGetNormalToNearestSurface(out Vector3)
Near pointers often interact with surfaces.
This method provides a mechanism to get the normal of the closest surface the near pointer is interacting with.
Declaration
bool IMixedRealityNearPointer.TryGetNormalToNearestSurface(out Vector3 normal)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | normal | Out parameter filled with the surface normal if available, otherwise Vector3.zero. |
Returns
Type | Description |
---|---|
Boolean | True if a normal was retrieved, false if not. |