Class SpherePointer
Inheritance
Implements
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.Input
Assembly: cs.temp.dll.dll
Syntax
public class SpherePointer : BaseControllerPointer, IMixedRealityControllerPoseSynchronizer, IMixedRealitySourcePoseHandler, IMixedRealitySourceStateHandler, IMixedRealityInputHandler, IMixedRealityBaseInputHandler, IMixedRealityInputHandler<float>, IMixedRealityInputHandler<Vector2>, IMixedRealityInputHandler<Vector3>, IMixedRealityInputHandler<Quaternion>, IMixedRealityInputHandler<MixedRealityPose>, IEventSystemHandler, IMixedRealityNearPointer, IMixedRealityPointer, IEqualityComparer
Fields
triggerInteraction
Declaration
protected QueryTriggerInteraction triggerInteraction
Field Value
Type | Description |
---|---|
QueryTriggerInteraction |
Properties
GrabLayerMasks
The LayerMasks, in prioritized order, that are used to determine the touchable objects.
Declaration
public LayerMask[] GrabLayerMasks { get; }
Property Value
Type | Description |
---|---|
LayerMask[] |
Remarks
Only NearInteractionGrabbables in one of the LayerMasks will raise events.
IgnoreCollidersNotInFOV
Whether to ignore colliders that may be near the pointer, but not actually in the visual FOV. This can prevent accidental grabs, and will allow hand rays to turn on when you may be near a grabbable 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
Test if the pointer is within the grabbable radius of collider that's both on a grabbable layer mask, and has a NearInteractionGrabbable. Uses SphereCastRadius to determine if near an object. Note: if focus on pointer is locked, will always return true.
Declaration
public override bool IsInteractionEnabled { get; }
Property Value
Type | Description |
---|---|
Boolean | True if the pointer is within the grabbable radius of collider that's both on a grabbable layer mask, and has a NearInteractionGrabbable. |
Overrides
IsNearObject
Test if the pointer is near any collider that's both on a grabbable layer mask, and has a NearInteractionGrabbable. Uses SphereCastRadius + NearObjectMargin to determine if near an object.
Declaration
public bool IsNearObject { get; }
Property Value
Type | Description |
---|---|
Boolean | True if the pointer is near any collider that's both on a grabbable layer mask, and has a NearInteractionGrabbable. |
NearObjectMargin
Additional distance on top ofSphereCastRadius when pointer is considered 'near' an object and far interaction will turn off.
Declaration
public float NearObjectMargin { get; }
Property Value
Type | Description |
---|---|
Single |
Remarks
This creates a dead zone in which far interaction is disabled before objects become grabbable.
NearObjectRadius
Distance at which the pointer is considered "near" an object.
Declaration
public float NearObjectRadius { get; }
Property Value
Type | Description |
---|---|
Single |
Remarks
Sum of SphereCastRadius and NearObjectMargin. Entering the NearObjectRadius disables far interaction.
SceneQueryBufferSize
Maximum number of colliders that can be detected in a scene query.
Declaration
public int SceneQueryBufferSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
SceneQueryType
The type of physics scene query to use.
Declaration
public override SceneQueryType SceneQueryType { get; set; }
Property Value
Type | Description |
---|---|
SceneQueryType |
Overrides
TriggerInteraction
Specify whether queries for grabbable objects hit triggers.
Declaration
public QueryTriggerInteraction TriggerInteraction { get; }
Property Value
Type | Description |
---|---|
QueryTriggerInteraction |
Methods
OnPreSceneQuery()
Called before performing the scene query.
Declaration
public override void OnPreSceneQuery()
Overrides
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
public bool 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. |
TryGetNearGraspPoint(out Vector3)
Gets the position of where grasp happens For IMixedRealityHand it's the average of index and thumb. For any other IMixedRealityController, return just the pointer origin
Declaration
public bool TryGetNearGraspPoint(out Vector3 result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | result |
Returns
Type | Description |
---|---|
Boolean |
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
public bool 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. |