편집

다음을 통해 공유


TapToPlace Class

Definition

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

public ref class TapToPlace : Microsoft::MixedReality::Toolkit::Utilities::Solvers::Solver, Microsoft::MixedReality::Toolkit::Input::IMixedRealityPointerHandler, UnityEngine::EventSystems::IEventSystemHandler
public class TapToPlace : Microsoft.MixedReality.Toolkit.Utilities.Solvers.Solver, Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler, UnityEngine.EventSystems.IEventSystemHandler
type TapToPlace = class
    inherit Solver
    interface IMixedRealityPointerHandler
    interface IEventSystemHandler
Public Class TapToPlace
Inherits Solver
Implements IEventSystemHandler, IMixedRealityPointerHandler
Inheritance
UnityEngine.MonoBehaviour
TapToPlace
Implements
IMixedRealityPointerHandler UnityEngine.EventSystems.IEventSystemHandler

Constructors

TapToPlace()

Fields

CurrentHit
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.

DidHitSurface
DoubleClickTimeout
LastTimeClicked
SolverHandler

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

(Inherited from Solver)

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.

DebugEnabled

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

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.

GameObjectLayer

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

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

If true, the game object to place is selected.

IsColliderPresent
KeepOrientationVertical

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

MagneticSurfaces

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

MaxRaycastDistance

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

MoveLerpTime

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

(Inherited from Solver)
OnPlacingStarted

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

OnPlacingStopped

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

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.

RotateLerpTime

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

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

UpdateLinkedTransform

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

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

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)
OnDestroy() (Inherited from Solver)
OnEnable()

Typically when a solver becomes enabled, it should update its internal state to the system, in case it was disabled far away

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

Called every frame a pointer is down. Can be used to implement drag-like behaviors.

OnPointerUp(MixedRealityPointerEventData)

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

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

SetRotation()
SnapGoalTo(Vector3, Quaternion, Vector3)

SnapGoalTo only sets the goal orientation. Not really useful.

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

SnapGoalTo only sets the goal orientation. Not really useful.

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

Snaps the solver to the desired pose.

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

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

StopPlacement()

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

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