HandMeshObserver Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides mesh updates each frame that track the detected shape of a hand.
public ref class HandMeshObserver sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 524288)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class HandMeshObserver final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 524288)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class HandMeshObserver
Public NotInheritable Class HandMeshObserver
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10, version 1903 (introduced in 10.0.18362.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v8.0)
|
Remarks
Creating a HandMeshObserver subscribes you to hand mesh updates for a given SpatialInteractionSource that tracks the detected shape of that hand.
When users are directly interacting with virtual objects with their hands, you may wish to render a visualization of the hands to increase the user's confidence in their interactions. By creating a HandMeshObserver, you can get a fixed index buffer for the hand up front by calling GetTriangleIndices, and then an updated vertex buffer each frame by calling GetVertexStateForPose. With these buffers, you can render a live visualization of the user's hand.
The hand mesh's index buffer will not change for the lifetime of the HandMeshObserver. The hand mesh's vertex buffer contents will be updated each frame, while the vertex count will not. You can therefore refill the same vertex buffer every frame.
You create a HandMeshObserver for a given interaction source by calling SpatialInteractionSource.TryCreateHandMeshObserverAsync or SpatialInteractionSource.TryCreateHandMeshObserver. It can take more than a frame to initialize the app's subscription to hand mesh updates. You should only call the synchronous version of the method from a background thread. If you are calling from a UI thread, render thread or update thread, you should call the asynchronous version instead.
Properties
ModelId |
Gets a hand mesh model ID to identify the same index buffer across multiple source detection and loss events. |
NeutralPose |
Gets the current neutral HandPose for this hand. |
NeutralPoseVersion |
Gets the version of the NeutralPose for this hand. |
Source |
The SpatialInteractionSource whose hand mesh is tracked by this HandMeshObserver. |
TriangleIndexCount |
Gets the number of elements in the index buffer for this hand mesh model. |
VertexCount |
Gets the count of vertices for this hand. |
Methods
GetTriangleIndices(UInt16[]) |
Fills an index buffer for this hand mesh model. |
GetVertexStateForPose(HandPose) |
Gets the vertex buffer and other state needed to render the hand mesh for a given frame's hand pose, or for the hand mesh's neutral pose. |