Modifier

Partager via


SurfaceMagnetism Class

Definition

SurfaceMagnetism casts rays to Surfaces in the world and aligns the object to the hit surface.

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

Constructors

SurfaceMagnetism()

Fields

SolverHandler

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

(Inherited from Solver)

Properties

BoxRaysPerEdge

Number of rays per edge, should be odd. Total casts is n^2

CloseDistance
Obsolete.

Closest distance to bring object

ClosestDistance

Closest distance to bring object

CurrentOrientationMode

How solver will orient model. See OrientationMode enum for possible modes. When mode=Blended, use OrientationBlend property to define ratio for blending

CurrentRaycastDirectionMode

Raycast direction type. Default is forward direction of Tracked Target transform

DebugEnabled

If enabled, the debug lines will be drawn in the editor

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

If true, ensures object is kept vertical for TrackedTarget, SurfaceNormal, and Blended Orientation Modes

MagneticSurfaces

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

MaxDistance
Obsolete.

Max distance for raycast to check for surfaces

MaximumNormalVariance

Align to ray cast direction if box cast hits many normals facing in varying directions

MaxRaycastDistance

Max distance for raycast to check for surfaces

MoveLerpTime

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

(Inherited from Solver)
OnSurface

Whether or not the object is currently magnetized to a surface.

OrientationBlend

Value used for when Orientation Mode=Blended. If 0.0 orientation is driven all by TrackedTarget mode and if 1.0 orientation is driven all by SurfaceNormal mode

OrthographicBoxCast

If true, use orthographic casting for box lines instead of perspective

RaycastMode

Surface raycast mode for solver

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

Radius to use for sphere cast

SurfaceNormalOffset

Offset from surface along surface normal

SurfaceRayOffset

Offset from surface along ray cast direction

UpdateLinkedTransform

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

(Inherited from Solver)
UseLinkedAltScaleOverride

When doing volume casts, use linked AltScale instead of object's current scale

VolumeCastSizeOverride

When doing volume casts, use size override if non-zero instead of object's current scale

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