Language
Edit

ObjectManipulator Class

Definition

This class allows for the move, rotate, and scale manipulation of an object by any interactor with a valid transform.

[UnityEngine.AddComponentMenu("MRTK/Spatial Manipulation/Object Manipulator")]
[UnityEngine.RequireComponent(typeof(MixedReality.Toolkit.SpatialManipulation.ConstraintManager))]
public class ObjectManipulator : MixedReality.Toolkit.StatefulInteractable
[<UnityEngine.AddComponentMenu("MRTK/Spatial Manipulation/Object Manipulator")>]
[<UnityEngine.RequireComponent(typeof(MixedReality.Toolkit.SpatialManipulation.ConstraintManager))>]
type ObjectManipulator = class
    inherit StatefulInteractable
Public Class ObjectManipulator
Inherits StatefulInteractable
Inheritance
UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable
ObjectManipulator
Attributes
UnityEngine.AddComponentMenuAttribute UnityEngine.RequireComponentAttribute

Remarks

Multi-handed interactions and physics-enabled objects are supported.

The ObjectManipulator class works with both rigidbody and non-rigidbody objects, and allows for throwing and catching interactions. Any interactor with an attach transform can interact with and manipulate an ObjectManipulator.

This is a drop-in replacement for the built-in Unity's UnityEngine.XR.Interaction.Toolkit.XRGrabInteractable, that allows for flexible multi-handed interactions. Note, the ObjectManipulator class doesn't track controller velocity, so for precise fast-paced throwing interactions that only need one hand, UnityEngine.XR.Interaction.Toolkit.XRGrabInteractable may give better results.

Constructors

Name Description
ObjectManipulator()

Properties

Name Description
AllowedInteractionTypes

Which types of interactions are allowed to manipulate this object?

AllowedManipulations

What kinds of manipulation should be allowed?

ApplyTorque

Apply torque to control orientation of the body

ConstraintsManager

Constraint manager slot to enable constraints when manipulating the object.

CurrentInteractionType

The current InteractionFlags for the current interaction.

CurrentRigidbodyMovementType

The current UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.MovementType of the rigid body during manipulation.

EnableConstraints

Enable or disable constraint support of this component. When enabled, transform changes will be post processed by the linked constraint manager.

HostTransform

Transform to be manipulated. Defaults to the object of the component.

ManipulationLogic

The instantiated manipulation logic objects, as specified by the types in ManipulationLogicTypes.

ManipulationLogicTypes

The concrete types of ManipulationLogic<T> to use for manipulations.

MoveLerpTime

Enter amount representing amount of smoothing to apply to the movement. Smoothing of 0 means no smoothing. Max value means no change to value.

ReleaseBehavior

Rigid body behavior of the dragged object when releasing it.

RigidbodyMovementType

The UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.MovementType of the rigid body during manipulation.

RotateLerpTime

Enter amount representing amount of smoothing to apply to the rotation. Smoothing of 0 means no smoothing. Max value means no change to value.

RotationAnchorFar

Rotation behavior of object when using one hand at distance

RotationAnchorNear

Rotation behavior of object when using one hand near

ScaleLerpTime

Enter amount representing amount of smoothing to apply to the scale. Smoothing of 0 means no smoothing. Max value means no change to value.

SmoothingFar

Whether to enable frame-rate independent smoothing for far interactions.

SmoothingNear

Whether to enable frame-rate independent smoothing for near interactions.

SpringDamping

The damping of the spring force and torque. A value of one corresponds to critical damping, lower values lead to under damping or oscillation.

SpringForceLimit

The maximum acceleration applied by the spring force to avoid trembling when pushing a body against a static object.

SpringForceSoftness

The time scale at which a Rigidbody reacts to input movement defined as oscillation period of the dampened spring force.

SpringTorqueSoftness

The time scale at which a Rigidbody reacts to input rotation defined as oscillation period of the dampened angular spring force.

TransformSmoothingLogicType

The concrete type of ITransformSmoothingLogic to use for smoothing between transforms.

Methods

Name Description
ApplyRequiredSettings()

Invoked on ObjectManipulator, Awake(), and Reset() to apply required settings to this ObjectManipulator instance.

Awake()

A Unity event function that is called when an enabled script instance is being loaded.

GetReferenceFrameTransform(SelectEnterEventArgs)

Override this class to provide the transform of the reference frame (e.g. the camera) against which to compute the damping.

This intended for the situation of FPS-style controllers moving forward at constant speed while holding an object, to prevent damping from pushing the body towards the player.

IsSelectableBy(IXRSelectInteractor) UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.IsSelectableBy(UnityEngine.XR.Interaction.Toolkit.IXRSelectInteractor)
ModifyTargetPose(MixedRealityTransform, TransformFlags)

Called by ApplyTargetPose to modify the target pose with the relevant constraints, smoothing, elastic, or any other derived/overridden behavior.

OnSelectEntered(SelectEnterEventArgs) UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.OnSelectEntered(UnityEngine.XR.Interaction.Toolkit.SelectEnterEventArgs)
OnSelectExited(SelectExitEventArgs) UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.OnSelectExited(UnityEngine.XR.Interaction.Toolkit.SelectExitEventArgs)
ProcessInteractable(XRInteractionUpdateOrder+UpdatePhase) UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.ProcessInteractable(UnityEngine.XR.Interaction.Toolkit.XRInteractionUpdateOrder.UpdatePhase)
Reset()

A Unity event function that is called when the script should reset it's default values

Applies to