Class Solver
The base abstract class for all Solvers to derive from. It provides state tracking, smoothing parameters and implementation, automatic solver system integration, and update order. Solvers may be used without a link, as long as updateLinkedTransform is false.
Inheritance
Implements
Namespace: Microsoft.MixedReality.Toolkit.Utilities.Solvers
Assembly: cs.temp.dll.dll
Syntax
public abstract class Solver : MonoBehaviour, MonoBehaviour
Fields
SolverHandler
The handler reference for this solver that's attached to this GameObject
Declaration
protected SolverHandler SolverHandler
Field Value
Type | Description |
---|---|
SolverHandler |
SolverHandler
The handler reference for this solver that's attached to this GameObject
Declaration
protected SolverHandler SolverHandler
Field Value
Type | Description |
---|---|
SolverHandler |
Properties
GoalPosition
The final position to be attained
Declaration
protected Vector3 GoalPosition { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
GoalPosition
The final position to be attained
Declaration
protected Vector3 GoalPosition { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
GoalRotation
The final rotation to be attained
Declaration
protected Quaternion GoalRotation { get; set; }
Property Value
Type | Description |
---|---|
Quaternion |
GoalRotation
The final rotation to be attained
Declaration
protected Quaternion GoalRotation { get; set; }
Property Value
Type | Description |
---|---|
Quaternion |
GoalScale
The final scale to be attained
Declaration
protected Vector3 GoalScale { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
GoalScale
The final scale to be attained
Declaration
protected Vector3 GoalScale { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
MoveLerpTime
If 0, the position will update immediately. Otherwise, the greater this attribute the slower the position updates
Declaration
public float MoveLerpTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
MoveLerpTime
If 0, the position will update immediately. Otherwise, the greater this attribute the slower the position updates
Declaration
public float MoveLerpTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
RotateLerpTime
If 0, the rotation will update immediately. Otherwise, the greater this attribute the slower the rotation updates")]
Declaration
public float RotateLerpTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
RotateLerpTime
If 0, the rotation will update immediately. Otherwise, the greater this attribute the slower the rotation updates")]
Declaration
public float RotateLerpTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
ScaleLerpTime
If 0, the scale will update immediately. Otherwise, the greater this attribute the slower the scale updates
Declaration
public float ScaleLerpTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
ScaleLerpTime
If 0, the scale will update immediately. Otherwise, the greater this attribute the slower the scale updates
Declaration
public float ScaleLerpTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
Smoothing
If true, updates are smoothed to the target. Otherwise, they are snapped to the target
Declaration
public bool Smoothing { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Smoothing
If true, updates are smoothed to the target. Otherwise, they are snapped to the target
Declaration
public bool Smoothing { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
UpdateLinkedTransform
If true, the position and orientation will be calculated, but not applied, for other components to use
Declaration
public bool UpdateLinkedTransform { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
UpdateLinkedTransform
If true, the position and orientation will be calculated, but not applied, for other components to use
Declaration
public bool UpdateLinkedTransform { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
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
Declaration
public Vector3 WorkingPosition { get; protected set; }
Property Value
Type | Description |
---|---|
Vector3 |
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
Declaration
public Vector3 WorkingPosition { get; protected set; }
Property Value
Type | Description |
---|---|
Vector3 |
WorkingRotation
Rotation version of WorkingPosition
Declaration
public Quaternion WorkingRotation { get; protected set; }
Property Value
Type | Description |
---|---|
Quaternion |
WorkingRotation
Rotation version of WorkingPosition
Declaration
public Quaternion WorkingRotation { get; protected set; }
Property Value
Type | Description |
---|---|
Quaternion |
WorkingScale
Scale version of WorkingPosition
Declaration
public Vector3 WorkingScale { get; protected set; }
Property Value
Type | Description |
---|---|
Vector3 |
WorkingScale
Scale version of WorkingPosition
Declaration
public Vector3 WorkingScale { get; protected set; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
AddOffset(Vector3)
Add an offset position to the target goal position.
Declaration
public virtual void AddOffset(Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | offset |
AddOffset(Vector3)
Add an offset position to the target goal position.
Declaration
public virtual void AddOffset(Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | offset |
Awake()
Declaration
protected virtual void Awake()
Awake()
Declaration
protected virtual void Awake()
OnDestroy()
Declaration
protected virtual void OnDestroy()
OnDestroy()
Declaration
protected virtual void OnDestroy()
OnEnable()
Typically when a solver becomes enabled, it should update its internal state to the system, in case it was disabled far away
Declaration
protected virtual void OnEnable()
OnEnable()
Typically when a solver becomes enabled, it should update its internal state to the system, in case it was disabled far away
Declaration
protected virtual void OnEnable()
SmoothTo(Quaternion, Quaternion, Single, Single)
Slerps Quaternion source to goal, handles lerpTime of 0
Declaration
public static Quaternion SmoothTo(Quaternion source, Quaternion goal, float deltaTime, float lerpTime)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | source | |
Quaternion | goal | |
Single | deltaTime | |
Single | lerpTime |
Returns
Type | Description |
---|---|
Quaternion |
SmoothTo(Quaternion, Quaternion, Single, Single)
Slerps Quaternion source to goal, handles lerpTime of 0
Declaration
public static Quaternion SmoothTo(Quaternion source, Quaternion goal, float deltaTime, float lerpTime)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | source | |
Quaternion | goal | |
Single | deltaTime | |
Single | lerpTime |
Returns
Type | Description |
---|---|
Quaternion |
SmoothTo(Vector3, Vector3, Single, Single)
Lerps Vector3 source to goal.
Declaration
public static Vector3 SmoothTo(Vector3 source, Vector3 goal, float deltaTime, float lerpTime)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | source | |
Vector3 | goal | |
Single | deltaTime | |
Single | lerpTime |
Returns
Type | Description |
---|---|
Vector3 |
Remarks
Handles lerpTime of 0.
SmoothTo(Vector3, Vector3, Single, Single)
Lerps Vector3 source to goal.
Declaration
public static Vector3 SmoothTo(Vector3 source, Vector3 goal, float deltaTime, float lerpTime)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | source | |
Vector3 | goal | |
Single | deltaTime | |
Single | lerpTime |
Returns
Type | Description |
---|---|
Vector3 |
Remarks
Handles lerpTime of 0.
SnapGoalTo(Vector3, Quaternion)
SnapGoalTo only sets the goal orientation. Not really useful.
Declaration
public virtual void SnapGoalTo(Vector3 position, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Quaternion | rotation |
SnapGoalTo(Vector3, Quaternion)
SnapGoalTo only sets the goal orientation. Not really useful.
Declaration
public virtual void SnapGoalTo(Vector3 position, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Quaternion | rotation |
SnapGoalTo(Vector3, Quaternion, Vector3)
SnapGoalTo only sets the goal orientation. Not really useful.
Declaration
public virtual void SnapGoalTo(Vector3 position, Quaternion rotation, Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Quaternion | rotation | |
Vector3 | scale |
SnapGoalTo(Vector3, Quaternion, Vector3)
SnapGoalTo only sets the goal orientation. Not really useful.
Declaration
public virtual void SnapGoalTo(Vector3 position, Quaternion rotation, Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Quaternion | rotation | |
Vector3 | scale |
SnapTo(Vector3, Quaternion)
Snaps the solver to the desired pose.
Declaration
public virtual void SnapTo(Vector3 position, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Quaternion | rotation |
Remarks
SnapTo may be used to bypass smoothing to a certain position if the object is teleported or spawned.
SnapTo(Vector3, Quaternion)
Snaps the solver to the desired pose.
Declaration
public virtual void SnapTo(Vector3 position, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Quaternion | rotation |
Remarks
SnapTo may be used to bypass smoothing to a certain position if the object is teleported or spawned.
SnapTo(Vector3, Quaternion, Vector3)
Snaps the solver to the desired pose.
Declaration
public virtual void SnapTo(Vector3 position, Quaternion rotation, Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Quaternion | rotation | |
Vector3 | scale |
Remarks
SnapTo may be used to bypass smoothing to a certain position if the object is teleported or spawned.
SnapTo(Vector3, Quaternion, Vector3)
Snaps the solver to the desired pose.
Declaration
public virtual void SnapTo(Vector3 position, Quaternion rotation, Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | |
Quaternion | rotation | |
Vector3 | scale |
Remarks
SnapTo may be used to bypass smoothing to a certain position if the object is teleported or spawned.
SolverUpdate()
Should be implemented in derived classes, but Solver can be used to flush shared transform to real transform
Declaration
public abstract void SolverUpdate()
SolverUpdate()
Should be implemented in derived classes, but Solver can be used to flush shared transform to real transform
Declaration
public abstract void SolverUpdate()
SolverUpdateEntry()
Tracks lifetime of the solver, disabling it when expired, and finally runs the orientation update logic
Declaration
public void SolverUpdateEntry()
SolverUpdateEntry()
Tracks lifetime of the solver, disabling it when expired, and finally runs the orientation update logic
Declaration
public void SolverUpdateEntry()
Start()
Declaration
protected virtual void Start()
Start()
Declaration
protected virtual void Start()
UpdateTransformToGoal()
Updates all object orientations to the goal orientation for this solver, with smoothing accounted for (smoothing may be off)
Declaration
protected void UpdateTransformToGoal()
UpdateTransformToGoal()
Updates all object orientations to the goal orientation for this solver, with smoothing accounted for (smoothing may be off)
Declaration
protected void UpdateTransformToGoal()
UpdateWorkingPositionToGoal()
Updates only the working position to goal with smoothing, if enabled
Declaration
public void UpdateWorkingPositionToGoal()
UpdateWorkingPositionToGoal()
Updates only the working position to goal with smoothing, if enabled
Declaration
public void UpdateWorkingPositionToGoal()
UpdateWorkingRotationToGoal()
Updates only the working rotation to goal with smoothing, if enabled
Declaration
public void UpdateWorkingRotationToGoal()
UpdateWorkingRotationToGoal()
Updates only the working rotation to goal with smoothing, if enabled
Declaration
public void UpdateWorkingRotationToGoal()
UpdateWorkingScaleToGoal()
Updates only the working scale to goal with smoothing, if enabled
Declaration
public void UpdateWorkingScaleToGoal()
UpdateWorkingScaleToGoal()
Updates only the working scale to goal with smoothing, if enabled
Declaration
public void UpdateWorkingScaleToGoal()
UpdateWorkingToGoal()
Updates the Working orientation (which may be the object, or the shared orientation) to the goal with smoothing, if enabled
Declaration
public void UpdateWorkingToGoal()
UpdateWorkingToGoal()
Updates the Working orientation (which may be the object, or the shared orientation) to the goal with smoothing, if enabled
Declaration
public void UpdateWorkingToGoal()