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

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

    Show / Hide Table of Contents

    Class TapToPlace

    Tap to place is a far interaction component used to place objects on a surface.

    Inheritance
    Object
    Solver
    TapToPlace
    Implements
    IMixedRealityPointerHandler
    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.OnEnable()
    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 TapToPlace : Solver, IMixedRealityPointerHandler

    Fields

    CurrentHit

    Declaration
    protected RaycastHit CurrentHit
    Field Value
    Type Description
    RaycastHit

    CurrentRay

    The current ray is based on the TrackedTargetType (Controller Ray, Head, Hand Joint). The following properties are updated each frame while the game object is selected to determine object placement if there is a hit on a surface.

    Declaration
    protected RayStep CurrentRay
    Field Value
    Type Description
    RayStep

    DidHitSurface

    Declaration
    protected bool DidHitSurface
    Field Value
    Type Description
    Boolean

    DoubleClickTimeout

    Declaration
    protected float DoubleClickTimeout
    Field Value
    Type Description
    Single

    LastTimeClicked

    Declaration
    protected float LastTimeClicked
    Field Value
    Type Description
    Single

    Properties

    AutoStart

    If true, the game object to place will start out selected. The object will immediately start following the TrackedTargetType (Head or Controller Ray) and then a tap is required to place the object.
    This value must be modified before Start() is invoked in order to have any effect.

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

    DebugEnabled

    If true and in the Unity Editor, the normal of the raycast hit will be drawn in yellow.

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

    DefaultPlacementDistance

    The default distance (in meters) an object will be placed relative to the TrackedTargetType forward in the SolverHandler. The GameObjectToPlace will be placed at the default placement distance if a surface is not hit by the raycast.

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

    GameObjectLayer

    The current game object layer before it is temporarily switched to IgnoreRaycast while placing the game object.

    Declaration
    protected int GameObjectLayer { get; set; }
    Property Value
    Type Description
    Int32

    IsBeingPlaced

    If true, the game object to place is selected.

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

    IsColliderPresent

    Declaration
    protected bool IsColliderPresent { get; }
    Property Value
    Type Description
    Boolean

    KeepOrientationVertical

    If true, the game object to place will remain upright and in line with Vector3.up

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

    MagneticSurfaces

    Array of LayerMask to execute from highest to lowest priority. First layermask to provide a raycast hit will be used by component.

    Declaration
    public LayerMask[] MagneticSurfaces { get; set; }
    Property Value
    Type Description
    LayerMask[]

    MaxRaycastDistance

    The max distance (in meters) to place an object if there is a raycast hit on a surface

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

    OnPlacingStarted

    This event is triggered once when the game object to place is selected.

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

    OnPlacingStopped

    This event is triggered once when the game object to place is unselected, placed.

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

    RotateAccordingToSurface

    If false, the game object to place will not change its rotation according to the surface hit. The object will remain facing the camera while IsBeingPlaced is true. If true, the object will rotate according to the surface normal if there is a hit.

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

    SurfaceNormalOffset

    The distance between the center of the game object to place and a surface along the surface normal, if the raycast hits a surface.

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

    UseDefaultSurfaceNormalOffset

    If true, the default surface normal offset will be used instead of any value specified for the SurfaceNormalOffset property.
    If false, the SurfaceNormalOffset is used. The default surface normal offset is the Z extents of the bounds on the attached collider, this ensures the object being placed is aligned on a surface.

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

    Methods

    OnPointerClicked(MixedRealityPointerEventData)

    Declaration
    public void OnPointerClicked(MixedRealityPointerEventData eventData)
    Parameters
    Type Name Description
    MixedRealityPointerEventData eventData

    OnPointerDown(MixedRealityPointerEventData)

    Declaration
    public void OnPointerDown(MixedRealityPointerEventData eventData)
    Parameters
    Type Name Description
    MixedRealityPointerEventData eventData

    OnPointerDragged(MixedRealityPointerEventData)

    Declaration
    public void OnPointerDragged(MixedRealityPointerEventData eventData)
    Parameters
    Type Name Description
    MixedRealityPointerEventData eventData

    OnPointerUp(MixedRealityPointerEventData)

    Declaration
    public void OnPointerUp(MixedRealityPointerEventData eventData)
    Parameters
    Type Name Description
    MixedRealityPointerEventData eventData

    PerformRaycast()

    Declaration
    protected virtual void PerformRaycast()

    SetPosition()

    Change the position of the game object if there was a hit, if not then place the object at the default distance relative to the TrackedTargetType origin position

    Declaration
    protected virtual void SetPosition()

    SetRotation()

    Declaration
    protected virtual void SetRotation()

    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()

    Start()

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

    StartPlacement()

    Start the placement of a game object without the need of the OnPointerClicked event. The game object will begin to follow the TrackedTargetType (Head by default) at a default distance. StopPlacement() must be called after StartPlacement() to stop the game object from following the TrackedTargetType. The game object layer is changed to IgnoreRaycast temporarily and then restored to its original layer in StopPlacement().

    Declaration
    public void StartPlacement()

    StopPlacement()

    Stop the placement of a game object without the need of the OnPointerClicked event.

    Declaration
    public void StopPlacement()

    Implements

    IMixedRealityPointerHandler
    Back to top Generated by DocFX