SpatialInteractionSourceState
SpatialInteractionSourceState
SpatialInteractionSourceState
SpatialInteractionSourceState
Class
Definition
Represents a snapshot of the state of a spatial interaction source (hand, motion controller or voice) at a given time.
public : sealed class SpatialInteractionSourceState : ISpatialInteractionSourceState, ISpatialInteractionSourceState2public sealed class SpatialInteractionSourceState : ISpatialInteractionSourceState, ISpatialInteractionSourceState2Public NotInheritable Class SpatialInteractionSourceState Implements ISpatialInteractionSourceState, ISpatialInteractionSourceState2// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10586.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v2)
|
Properties
ControllerProperties ControllerProperties ControllerProperties ControllerProperties
Gets state specific to motion controllers.
public : SpatialInteractionControllerProperties ControllerProperties { get; }public SpatialInteractionControllerProperties ControllerProperties { get; }Public ReadOnly Property ControllerProperties As SpatialInteractionControllerProperties// You can use this property in JavaScript.
- Value
- SpatialInteractionControllerProperties SpatialInteractionControllerProperties SpatialInteractionControllerProperties SpatialInteractionControllerProperties
The motion controller properties.
| Device family |
Windows 10 Creators Update (introduced v10.0.15063.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v4)
|
Remarks
This property will return null if this source is not a motion controller.
IsGrasped IsGrasped IsGrasped IsGrasped
Gets whether a motion controller is experiencing a grasp.
public : PlatForm::Boolean IsGrasped { get; }public bool IsGrasped { get; }Public ReadOnly Property IsGrasped As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
Whether the source is experiencing a grasp.
| Device family |
Windows 10 Creators Update (introduced v10.0.15063.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v4)
|
Remarks
For motion controllers, a grasp represents the user squeezing their fist tightly. This may be detected by grip buttons or a palm trigger.
For all other spatial interaction sources, IsGrasped will be false.
IsMenuPressed IsMenuPressed IsMenuPressed IsMenuPressed
Gets whether a motion controller is experiencing a Menu press.
public : PlatForm::Boolean IsMenuPressed { get; }public bool IsMenuPressed { get; }Public ReadOnly Property IsMenuPressed As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
Whether the source is experiencing a Menu press.
| Device family |
Windows 10 Creators Update (introduced v10.0.15063.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v4)
|
Remarks
For motion controllers, a Menu press represents the controller's Menu button being pressed.
For all other spatial interaction sources, IsMenuPressed will be false.
IsPressed IsPressed IsPressed IsPressed
Gets whether a hand or motion controller is experiencing any press.
public : PlatForm::Boolean IsPressed { get; }public bool IsPressed { get; }Public ReadOnly Property IsPressed As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
Whether the source is experiencing any press.
Remarks
This can be because a hand has a finger pressed or a motion controller has any button pressed.
To determine which specific presses are occurring, inspect the state's more specific properties such as IsSelectPressed, IsMenuPressed or IsGrasped. If this source is a motion controller, there are further controller-specific properties to inspect within the state's ControllerProperties.
Note that a voice "Select" causes an instant press and release, and so you cannot poll for a voice press using IsPressed, IsSelectPressed or SelectPressedValue. Instead, use a SpatialGestureRecognizer and handle the Tapped event, or handle the SourcePressed event.
IsSelectPressed IsSelectPressed IsSelectPressed IsSelectPressed
Gets whether a hand or motion controller is experiencing a primary Select press.
public : PlatForm::Boolean IsSelectPressed { get; }public bool IsSelectPressed { get; }Public ReadOnly Property IsSelectPressed As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
Whether the source is experiencing a Select press.
| Device family |
Windows 10 Creators Update (introduced v10.0.15063.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v4)
|
Remarks
Select represents the primary press for a spatial interaction source:
- For hands, a Select press represents the user's index finger in the down position.
- For motion controllers, a Select press represents the controller's index-finger trigger (or primary face button, if no trigger) being fully pressed.
- For voice, a Select press represents the user saying the system keyword "Select".
Note that a voice "Select" causes an instant press and release, and so you cannot poll for a voice press using IsPressed, IsSelectPressed or SelectPressedValue. Instead, use a SpatialGestureRecognizer and handle the Tapped event, or handle the SourcePressed event.
Properties Properties Properties Properties
Gets advanced state of the interaction source.
public : SpatialInteractionSourceProperties Properties { get; }public SpatialInteractionSourceProperties Properties { get; }Public ReadOnly Property Properties As SpatialInteractionSourceProperties// You can use this property in JavaScript.
SelectPressedValue SelectPressedValue SelectPressedValue SelectPressedValue
Gets the amount to which a hand or motion controller is experiencing a primary Select press, as a value between 0.0 and 1.0.
public : double SelectPressedValue { get; }public double SelectPressedValue { get; }Public ReadOnly Property SelectPressedValue As double// You can use this property in JavaScript.
- Value
- double double double double
The amount to which the source is experiencing a Select press.
| Device family |
Windows 10 Creators Update (introduced v10.0.15063.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v4)
|
Remarks
SelectPressedValue ranges from 0.0 to 1.0, with 0.0 representing no Select press and 1.0 representing a full Select press. IsPressed will only return true once the SelectPressedValue reaches 1.0. If a given source can only detect an on/off state for Select presses, the value will always be 0.0 or 1.0.
Select represents the primary press for a spatial interaction source:
- For hands, a Select press represents the user's index finger in the down position.
- For motion controllers, a Select press represents the controller's index-finger trigger (or primary face button, if no trigger) being fully pressed.
- For voice, a Select press represents the user saying the system keyword "Select".
Note that a voice "Select" causes an instant press and release, and so you cannot poll for a voice press using IsPressed, IsSelectPressed or SelectPressedValue. Instead, use a SpatialGestureRecognizer and handle the Tapped event, or handle the SourcePressed event.
Source Source Source Source
Gets the interaction source that this state describes.
public : SpatialInteractionSource Source { get; }public SpatialInteractionSource Source { get; }Public ReadOnly Property Source As SpatialInteractionSource// You can use this property in JavaScript.
Timestamp Timestamp Timestamp Timestamp
Gets the timestamp at which this state snapshot was taken.
public : PerceptionTimestamp Timestamp { get; }public PerceptionTimestamp Timestamp { get; }Public ReadOnly Property Timestamp As PerceptionTimestamp// You can use this property in JavaScript.
The timestamp.
Methods
TryGetPointerPose(SpatialCoordinateSystem) TryGetPointerPose(SpatialCoordinateSystem) TryGetPointerPose(SpatialCoordinateSystem) TryGetPointerPose(SpatialCoordinateSystem)
Gets the available pointer poses, such as the user's head gaze and each motion controller's pointer pose, for the timestamp when this state snapshot was taken.
public : SpatialPointerPose TryGetPointerPose(SpatialCoordinateSystem coordinateSystem)public SpatialPointerPose TryGetPointerPose(SpatialCoordinateSystem coordinateSystem)Public Function TryGetPointerPose(coordinateSystem As SpatialCoordinateSystem) As SpatialPointerPose// You can use this method in JavaScript.
- coordinateSystem
- SpatialCoordinateSystem SpatialCoordinateSystem SpatialCoordinateSystem SpatialCoordinateSystem
The coordinate system in which to express the pointer poses.
The pointer poses.
Remarks
When targeting a spatial interaction, such as a hand gesture, motion controller press or voice interaction, apps should choose a pointing ray available from the interaction's SpatialPointerPose, based on the nature of the interaction's SpatialInteractionSource:
- If the interaction source does not support pointing (IsPointingSupported is false), the app should target based on the user's gaze, available through the Head property.
- If the interaction source does support pointing (IsPointingSupported is true), the app may instead target based on the source's pointer pose, available through the TryGetInteractionSourcePose method.
The app should then intersect the chosen pointing ray with its own holograms or with the spatial mapping mesh to render cursors and determine what the user is intending to interact with.
Once an interaction has started, relative motions of the hand or controller may be used to control the gesture, as with the Manipulation or Navigation gesture.
This method will return null if the specified coordinate system cannot be located at the moment.