Modifier

Partager via


ObjectManipulator Class

Definition

This script allows for an object to be movable, scalable, and rotatable with one or two hands. You may also configure the script on only enable certain manipulations. The script works with both HoloLens' gesture input and immersive headset's motion controller input.

public ref class ObjectManipulator : UnityEngine::MonoBehaviour, Microsoft::MixedReality::Toolkit::Input::IMixedRealityFocusChangedHandler, Microsoft::MixedReality::Toolkit::Input::IMixedRealityPointerHandler, UnityEngine::EventSystems::IEventSystemHandler
public ref class ObjectManipulator : UnityEngine::MonoBehaviour, Microsoft::MixedReality::Toolkit::Input::IMixedRealityFocusChangedHandler, Microsoft::MixedReality::Toolkit::Input::IMixedRealityPointerHandler, Microsoft::MixedReality::Toolkit::Input::IMixedRealitySourcePoseHandler, UnityEngine::EventSystems::IEventSystemHandler
[UnityEngine.HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/ux-building-blocks/object-manipulator")]
[UnityEngine.RequireComponent(typeof(Microsoft.MixedReality.Toolkit.UI.ConstraintManager))]
public class ObjectManipulator : UnityEngine.MonoBehaviour, Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusChangedHandler, Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler, UnityEngine.EventSystems.IEventSystemHandler
[UnityEngine.HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/ux-building-blocks/object-manipulator")]
[UnityEngine.RequireComponent(typeof(Microsoft.MixedReality.Toolkit.UI.ConstraintManager))]
public class ObjectManipulator : UnityEngine.MonoBehaviour, Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusChangedHandler, Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler, Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler, UnityEngine.EventSystems.IEventSystemHandler
[<UnityEngine.HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/ux-building-blocks/object-manipulator")>]
[<UnityEngine.RequireComponent(typeof(Microsoft.MixedReality.Toolkit.UI.ConstraintManager))>]
type ObjectManipulator = class
    inherit MonoBehaviour
    interface IMixedRealityPointerHandler
    interface IEventSystemHandler
    interface IMixedRealityFocusChangedHandler
[<UnityEngine.HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/ux-building-blocks/object-manipulator")>]
[<UnityEngine.RequireComponent(typeof(Microsoft.MixedReality.Toolkit.UI.ConstraintManager))>]
type ObjectManipulator = class
    inherit MonoBehaviour
    interface IMixedRealityPointerHandler
    interface IEventSystemHandler
    interface IMixedRealityFocusChangedHandler
    interface IMixedRealitySourcePoseHandler
    interface IMixedRealitySourceStateHandler
Public Class ObjectManipulator
Inherits MonoBehaviour
Implements IEventSystemHandler, IMixedRealityFocusChangedHandler, IMixedRealityPointerHandler
Public Class ObjectManipulator
Inherits MonoBehaviour
Implements IEventSystemHandler, IMixedRealityFocusChangedHandler, IMixedRealityPointerHandler, IMixedRealitySourcePoseHandler
Inheritance
UnityEngine.MonoBehaviour
ObjectManipulator
Attributes
UnityEngine.HelpURLAttribute UnityEngine.RequireComponentAttribute
Implements

Constructors

ObjectManipulator()

Properties

AllowFarManipulation

Specifies whether manipulation can be done using far interaction with pointers.

ConstraintsManager

Constraint manager slot to enable constraints when manipulating the object.

ElasticsManager

Elastics Manager slot to enable elastics simulation when manipulating the object.

EnableConstraints

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

HostTransform

Transform that will be dragged. Defaults to the object of the component.

ManipulationType

Can manipulation be done only with one hand, only with two hands, or with both?

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.

OneHandRotationModeFar

Rotation behavior of object when using one hand at distance

OneHandRotationModeNear

Rotation behavior of object when using one hand near

OnHoverEntered

Unity event raised on hover started

OnHoverExited

Unity event raised on hover ended

OnManipulationEnded

Unity event raised on manipulation ended

OnManipulationStarted

Unity event raised on manipulation started

ReleaseBehavior

Rigid body behavior of the dragged object when releasing it.

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.

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.

SmoothingActive
Obsolete.

Obsolete: Whether to enable frame-rate independent smoothing.

SmoothingFar

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

SmoothingNear

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

TwoHandedManipulationType

What manipulation will two hands perform?

UseForcesForNearManipulation

Whether physics forces are used to move the object when performing near manipulations.

Methods

ForceEndManipulation()

Releases the object that is currently manipulated

GetPointerGrabPoint(UInt32)

Gets the grab point for the given pointer id. Only use if you know that your given pointer id corresponds to a pointer that has grabbed this component.

OnBeforeFocusChange(FocusEventData)
OnFocusChanged(FocusEventData)
OnPointerClicked(MixedRealityPointerEventData)

When a pointer clicked event is raised, this method is used to pass along the event data to the input handler.

OnPointerDown(MixedRealityPointerEventData)

When a pointer down event is raised, this method is used to pass along the event data to the input handler.

OnPointerDragged(MixedRealityPointerEventData)
OnPointerUp(MixedRealityPointerEventData)

When a pointer up event is raised, this method is used to pass along the event data to the input handler.

OnSourceDetected(SourceStateEventData)
OnSourceLost(SourceStateEventData)
OnSourcePoseChanged(SourcePoseEventData<MixedRealityPose>)

Raised when the source pose is changed.

OnSourcePoseChanged(SourcePoseEventData<Quaternion>)

Raised when the source rotation is changed.

OnSourcePoseChanged(SourcePoseEventData<TrackingState>)

Raised when the source pose tracking state is changed.

OnSourcePoseChanged(SourcePoseEventData<Vector2>)

Raised when the source position is changed.

OnSourcePoseChanged(SourcePoseEventData<Vector3>)

Raised when the source position is changed.

Start()

Applies to