日本語翻訳ドキュメントはサポートを終了しました

MRTK 2.6 以降のドキュメントについては、公式の Microsoft ドキュメント を参照してください。

    Show / Hide Table of Contents

    Class HandConstraint

    Provides a solver that constrains the target to a region safe for hand constrained interactive content. This solver is intended to work with IMixedRealityHand but also works with IMixedRealityController.

    Inheritance
    Object
    Solver
    HandConstraint
    HandConstraintPalmUp
    Inherited Members
    Solver.UpdateLinkedTransform
    Solver.MoveLerpTime
    Solver.RotateLerpTime
    Solver.ScaleLerpTime
    Solver.Smoothing
    Solver.SolverHandler
    Solver.GoalPosition
    Solver.GoalRotation
    Solver.GoalScale
    Solver.WorkingPosition
    Solver.WorkingRotation
    Solver.WorkingScale
    Solver.Awake()
    Solver.Start()
    Solver.OnDestroy()
    Solver.SolverUpdateEntry()
    Solver.SnapTo(Vector3, Quaternion, Vector3)
    Solver.SnapGoalTo(Vector3, Quaternion, Vector3)
    Solver.SnapTo(Vector3, Quaternion)
    Solver.SnapGoalTo(Vector3, Quaternion)
    Solver.AddOffset(Vector3)
    Solver.SmoothTo(Vector3, Vector3, Single, Single)
    Solver.SmoothTo(Quaternion, Quaternion, Single, Single)
    Solver.UpdateTransformToGoal()
    Solver.UpdateWorkingToGoal()
    Solver.UpdateWorkingPositionToGoal()
    Solver.UpdateWorkingRotationToGoal()
    Solver.UpdateWorkingScaleToGoal()
    Namespace: Microsoft.MixedReality.Toolkit.Utilities.Solvers
    Assembly: cs.temp.dll.dll
    Syntax
    public class HandConstraint : Solver

    Fields

    handBounds

    Declaration
    protected HandBounds handBounds
    Field Value
    Type Description
    HandBounds

    trackedController

    Declaration
    protected IMixedRealityController trackedController
    Field Value
    Type Description
    IMixedRealityController

    Properties

    ForwardOffset

    Additional offset to apply towards the user.

    Declaration
    public float ForwardOffset { get; set; }
    Property Value
    Type Description
    Single

    Handedness

    Declaration
    public Handedness Handedness { get; }
    Property Value
    Type Description
    Handedness

    HideHandCursorsOnActivate

    When a hand is activated for tracking, should the cursor(s) be disabled on that hand?

    Declaration
    public bool HideHandCursorsOnActivate { get; set; }
    Property Value
    Type Description
    Boolean

    OffsetBehavior

    Specifies how the solver's offset relative to the hand will be computed.

    Declaration
    public HandConstraint.SolverOffsetBehavior OffsetBehavior { get; set; }
    Property Value
    Type Description
    HandConstraint.SolverOffsetBehavior

    OnFirstHandDetected

    Event which is triggered when zero hands to one hand is tracked.

    Declaration
    public UnityEvent OnFirstHandDetected { get; set; }
    Property Value
    Type Description
    UnityEvent

    OnHandActivate

    Event which is triggered when a hand begins being tracked.

    Declaration
    public UnityEvent OnHandActivate { get; set; }
    Property Value
    Type Description
    UnityEvent

    OnHandDeactivate

    Event which is triggered when a hand stops being tracked.

    Declaration
    public UnityEvent OnHandDeactivate { get; set; }
    Property Value
    Type Description
    UnityEvent

    OnLastHandLost

    Event which is triggered when all hands are lost.

    Declaration
    public UnityEvent OnLastHandLost { get; set; }
    Property Value
    Type Description
    UnityEvent

    RotationBehavior

    Specifies how the solver should rotate when tracking the hand.

    Declaration
    public HandConstraint.SolverRotationBehavior RotationBehavior { get; set; }
    Property Value
    Type Description
    HandConstraint.SolverRotationBehavior

    SafeZone

    Which part of the hand to move the tracked object towards. The ulnar side of the hand is recommended for most situations.

    Declaration
    public HandConstraint.SolverSafeZone SafeZone { get; set; }
    Property Value
    Type Description
    HandConstraint.SolverSafeZone

    SafeZoneAngleOffset

    Additional degree offset to apply clockwise from the stated SafeZone. Direction is clockwise on the left hand and anti-clockwise on the right hand.

    Declaration
    public float SafeZoneAngleOffset { get; set; }
    Property Value
    Type Description
    Single

    SafeZoneBuffer

    Additional offset to apply to the intersection point with the hand bounds.

    Declaration
    public float SafeZoneBuffer { get; set; }
    Property Value
    Type Description
    Single

    UpdateWhenOppositeHandNear

    Should the solver continue to move when the opposite hand (hand which is not being tracked) is near the tracked hand. This can improve stability when one hand occludes the other."

    Declaration
    public bool UpdateWhenOppositeHandNear { get; set; }
    Property Value
    Type Description
    Boolean

    Methods

    CalculateGoalPosition()

    Performs a ray vs AABB test to determine where the solver can constrain the tracked object without intersection. The "safe zone" is calculated as if projected into the horizontal and vertical plane of the camera.

    Declaration
    protected virtual Vector3 CalculateGoalPosition()
    Returns
    Type Description
    Vector3

    The new goal position.

    CalculateGoalRotation()

    Determines the solver's goal rotation based off of the SolverRotationBehavior.

    Declaration
    protected virtual Quaternion CalculateGoalRotation()
    Returns
    Type Description
    Quaternion

    The new goal rotation.

    GetController(Handedness)

    Returns the first detected controller in the input system that matches the passed-in handedness

    Declaration
    protected static IMixedRealityController GetController(Handedness handedness)
    Parameters
    Type Name Description
    Handedness handedness

    The handedness of the returned controller

    Returns
    Type Description
    IMixedRealityController

    The IMixedRealityController for the desired handedness, or null if none are present.

    IsOppositeHandNear(IMixedRealityController)

    Performs an intersection test to see if the left hand is near the right hand or vice versa.

    Declaration
    protected virtual bool IsOppositeHandNear(IMixedRealityController controller)
    Parameters
    Type Name Description
    IMixedRealityController controller

    The hand to check against.

    Returns
    Type Description
    Boolean

    True, when hands are near each other.

    IsValidController(IMixedRealityController)

    Determines if a hand meets the requirements for use with constraining the tracked object.

    Declaration
    protected virtual bool IsValidController(IMixedRealityController controller)
    Parameters
    Type Name Description
    IMixedRealityController controller

    The controller to check against.

    Returns
    Type Description
    Boolean

    True if this hand should be used from tracking.

    OnEnable()

    Declaration
    protected override void OnEnable()
    Overrides
    Solver.OnEnable()

    SolverUpdate()

    Should be implemented in derived classes, but Solver can be used to flush shared transform to real transform

    Declaration
    public override void SolverUpdate()
    Overrides
    Solver.SolverUpdate()

    ToggleCursors(IMixedRealityController, Boolean, Boolean)

    Enables/disables all cursors on the currently tracked hand.

    Declaration
    protected virtual IEnumerator ToggleCursors(IMixedRealityController controller, bool visible, bool frameDelay = false)
    Parameters
    Type Name Description
    IMixedRealityController controller

    Controller target to search for pointers

    Boolean visible

    Is the cursor visible?

    Boolean frameDelay

    Delay one frame before performing the toggle to allow the pointers to instantiate their cursors.

    Returns
    Type Description
    IEnumerator
    Back to top Generated by DocFX