Struct XRHandMeshData
Low-level meshing data. If the call that retrieved this from TryGetMeshData(out XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams) was successful, positions, normals, and uvs will all have the same length.
Implements
Inherited Members
Namespace: UnityEngine.XR.Hands.Meshing
Assembly: Unity.XR.Hands.dll
Syntax
public struct XRHandMeshData : IDisposable
Properties
boneWeights
Bone weights for each vertex, sorted by vertex index.
Declaration
public NativeArray<BoneWeight1> boneWeights { get; }
Property Value
| Type | Description |
|---|---|
| NativeArray<BoneWeight1> | Can only be valid if the call to TryGetMeshData(out XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams)
that retrieved this way successful, but may still not be valid, so check
its |
bonesPerVertex
Bone count for each vertex.
Declaration
public NativeArray<byte> bonesPerVertex { get; }
Property Value
| Type | Description |
|---|---|
| NativeArray<byte> | Can only be valid if the call to TryGetMeshData(out XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams)
that retrieved this way successful, but may still not be valid, so check
its |
handedness
Represents which hand this mesh data represents.
Declaration
public readonly Handedness handedness { get; }
Property Value
| Type | Description |
|---|---|
| Handedness | Right, left, or invalid. |
indices
Indices into the other arrays in this type for triangle data.
Declaration
public NativeArray<int> indices { get; }
Property Value
| Type | Description |
|---|---|
| NativeArray<int> | Can only be valid if the call to TryGetMeshData(out XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams)
that retrieved this way successful, but may still not be valid, so check
its |
jointBindPoseMatricesRaw
Raw joint bind pose matrices. Prefer TryGetJointBindPoseMatrix(out Matrix4x4, XRHandJointID) for safe per-joint access with validity checks.
Declaration
public NativeArray<Matrix4x4> jointBindPoseMatricesRaw { get; }
Property Value
| Type | Description |
|---|---|
| NativeArray<Matrix4x4> |
normals
Normals of vertices.
Declaration
public NativeArray<Vector3> normals { get; }
Property Value
| Type | Description |
|---|---|
| NativeArray<Vector3> | Can only be valid if the call to TryGetMeshData(out XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams)
that retrieved this way successful, but may still not be valid, so check
its |
positions
Positions of vertices, in session space.
Declaration
public NativeArray<Vector3> positions { get; }
Property Value
| Type | Description |
|---|---|
| NativeArray<Vector3> | Can only be valid if the call to TryGetMeshData(out XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams)
that retrieved this way successful, but may still not be valid, so check
its |
uvs
Texture UV coordinates of vertices.
Declaration
public NativeArray<Vector2> uvs { get; }
Property Value
| Type | Description |
|---|---|
| NativeArray<Vector2> | Can only be valid if the call to TryGetMeshData(out XRHandMeshDataQueryResult, ref XRHandMeshDataQueryParams)
that retrieved this way successful, but may still not be valid, so check
its |
Methods
Dispose()
Dispose of array data in this object.
Declaration
public void Dispose()
Remarks
This method is idempotent, meaning it doesn't matter if it gets
duplicate calls. Since XRHandMeshDataQueryResult's
Dispose() calls this, that
that means Dispose is safe to call on just leftHand
and rightHand, just the
containing XRHandMeshDataQueryResult, or both sets.
TryGetJointBindPoseMatrix(out Matrix4x4, XRHandJointID)
Retrieves joint pose, if this frame's data had one available.
Declaration
public bool TryGetJointBindPoseMatrix(out Matrix4x4 bindPose, XRHandJointID jointID)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4x4 | bindPose | If this function succeeds, this will be filled out with the bind pose
Matrix4x4 for corresponding joint represented by
|
| XRHandJointID | jointID | ID of joint for the bind pose being requested. |
Returns
| Type | Description |
|---|---|
| bool | Returns true if successful and the bindPose was filled out, returns false otherwise. |
Remarks
If this function fails, you should instead offset the requested joint's bind Pose by the offset from the previous frame.
TryGetJointRadius(out float, XRHandJointID)
Retrieves joint radius, if this frame's data had one available.
Declaration
public bool TryGetJointRadius(out float radius, XRHandJointID jointID)
Parameters
| Type | Name | Description |
|---|---|---|
| float | radius | If this function succeeds, this will be filled out with the
radius of corresponding joint represented by
|
| XRHandJointID | jointID | ID of joint for the radius being requested. |
Returns
| Type | Description |
|---|---|
| bool | Returns true if successful and the radius was filled out, returns false otherwise. |
TryGetRootPose(out Pose)
Retrieves root pose, if this frame's data had one available.
Declaration
public bool TryGetRootPose(out Pose rootPose)
Parameters
| Type | Name | Description |
|---|---|---|
| Pose | rootPose | If this function succeeds, this will be filled out with the root Pose for how the mesh data in this object is intended to be drawn. This pose should not be used otherwise. |
Returns
| Type | Description |
|---|---|
| bool | Returns true if successful and the root pose was filled out, returns false otherwise. |
Remarks
If this function fails, you should continue to use the previous pose. If there has been no successful pose retrieval yet, the closest approximation would be the Pose of the wrist joint.