HandConstraint Class

Definition

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.

public ref class HandConstraint : Microsoft::MixedReality::Toolkit::Utilities::Solvers::Solver
[UnityEngine.AddComponentMenu("Scripts/MRTK/SDK/HandConstraint")]
[UnityEngine.RequireComponent(typeof(Microsoft.MixedReality.Toolkit.Input.HandBounds))]
public class HandConstraint : Microsoft.MixedReality.Toolkit.Utilities.Solvers.Solver
[<UnityEngine.AddComponentMenu("Scripts/MRTK/SDK/HandConstraint")>]
[<UnityEngine.RequireComponent(typeof(Microsoft.MixedReality.Toolkit.Input.HandBounds))>]
type HandConstraint = class
    inherit Solver
Public Class HandConstraint
Inherits Solver
Inheritance
UnityEngine.MonoBehaviour
HandConstraint
Derived
Attributes
UnityEngine.AddComponentMenuAttribute UnityEngine.RequireComponentAttribute

Constructors

HandConstraint()

Fields

handBounds
SolverHandler

The handler reference for this solver that's attached to this GameObject

(Inherited from Solver)
trackedController

Properties

ForwardOffset

Additional offset to apply towards the user.

GoalPosition

The final position to be attained

(Inherited from Solver)
GoalRotation

The final rotation to be attained

(Inherited from Solver)
GoalScale

The final scale to be attained

(Inherited from Solver)
Handedness
HideHandCursorsOnActivate

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

MoveLerpTime

If 0, the position will update immediately. Otherwise, the greater this attribute the slower the position updates

(Inherited from Solver)
OffsetBehavior

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

OnFirstHandDetected

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

OnHandActivate

Event which is triggered when a hand begins being tracked.

OnHandDeactivate

Event which is triggered when a hand stops being tracked.

OnLastHandLost

Event which is triggered when all hands are lost.

RotateLerpTime

If 0, the rotation will update immediately. Otherwise, the greater this attribute the slower the rotation updates")]

(Inherited from Solver)
RotationBehavior

Specifies how the solver should rotate when tracking the hand.

SafeZone

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

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.

SafeZoneBuffer

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

ScaleLerpTime

If 0, the scale will update immediately. Otherwise, the greater this attribute the slower the scale updates

(Inherited from Solver)
Smoothing

If true, updates are smoothed to the target. Otherwise, they are snapped to the target

(Inherited from Solver)
UpdateLinkedTransform

If true, the position and orientation will be calculated, but not applied, for other components to use

(Inherited from Solver)
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."

WorkingPosition

Automatically uses the shared position if the solver is set to use the 'linked transform'. UpdateLinkedTransform may be set to false, and a solver will automatically update the object directly, and not inherit work done by other solvers to the shared position

(Inherited from Solver)
WorkingRotation

Rotation version of WorkingPosition

(Inherited from Solver)
WorkingScale

Scale version of WorkingPosition

(Inherited from Solver)

Methods

AddOffset(Vector3)

Add an offset position to the target goal position.

(Inherited from Solver)
Awake() (Inherited from Solver)
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.

CalculateGoalRotation()

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

GetController(Handedness)

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

IsOppositeHandNear(IMixedRealityController)

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

IsValidController(IMixedRealityController)

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

OnDestroy() (Inherited from Solver)
OnEnable()
SnapGoalTo(Vector3, Quaternion)
Obsolete.

SnapGoalTo only sets the goal orientation. Not really useful.

(Inherited from Solver)
SnapGoalTo(Vector3, Quaternion, Vector3)

SnapGoalTo only sets the goal orientation. Not really useful.

(Inherited from Solver)
SnapTo(Vector3, Quaternion)
Obsolete.

Snaps the solver to the desired pose.

(Inherited from Solver)
SnapTo(Vector3, Quaternion, Vector3)

Snaps the solver to the desired pose.

(Inherited from Solver)
SolverUpdate()

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

SolverUpdateEntry()

Tracks lifetime of the solver, disabling it when expired, and finally runs the orientation update logic

(Inherited from Solver)
Start() (Inherited from Solver)
ToggleCursors(IMixedRealityController, Boolean, Boolean)

Enables/disables all cursors on the currently tracked hand.

UpdateTransformToGoal()

Updates all object orientations to the goal orientation for this solver, with smoothing accounted for (smoothing may be off)

(Inherited from Solver)
UpdateWorkingPositionToGoal()

Updates only the working position to goal with smoothing, if enabled

(Inherited from Solver)
UpdateWorkingRotationToGoal()

Updates only the working rotation to goal with smoothing, if enabled

(Inherited from Solver)
UpdateWorkingScaleToGoal()

Updates only the working scale to goal with smoothing, if enabled

(Inherited from Solver)
UpdateWorkingToGoal()

Updates the Working orientation (which may be the object, or the shared orientation) to the goal with smoothing, if enabled

(Inherited from Solver)

Applies to