Dela via


InteractionTracker.TryUpdatePosition Method

Definition

Overloads

TryUpdatePosition(Vector3, InteractionTrackerClampingOption, InteractionTrackerPositionUpdateOption)

Tries to update the position of the InteractionTracker using the specified clamping option.

TryUpdatePosition(Vector3)

Tries to update the InteractionTracker's position.

The TryUpdatePosition method updates the location of InteractionTracker to the Vector3 position specified as a parameter. TryUpdatePosition is used to declaratively define the position of InteractionTracker at any point in time (either at start, from some state-entered event, etc.). TryUpdatePosition can be called from either the Idle, CustomAnimation or Inertia state – doing so will move the position of InteractionTracker to the defined position and enter the idle state.

TryUpdatePosition(Vector3, InteractionTrackerClampingOption)

Tries to update the position of the InteractionTracker using the specified clamping option.

TryUpdatePosition(Vector3, InteractionTrackerClampingOption, InteractionTrackerPositionUpdateOption)

Tries to update the position of the InteractionTracker using the specified clamping option.

public:
 virtual int TryUpdatePosition(float3 value, InteractionTrackerClampingOption option, InteractionTrackerPositionUpdateOption posUpdateOption) = TryUpdatePosition;
/// [Windows.Foundation.Metadata.Overload("TryUpdatePositionWithOption")]
int TryUpdatePosition(float3 const& value, InteractionTrackerClampingOption const& option, InteractionTrackerPositionUpdateOption const& posUpdateOption);
[Windows.Foundation.Metadata.Overload("TryUpdatePositionWithOption")]
public int TryUpdatePosition(Vector3 value, InteractionTrackerClampingOption option, InteractionTrackerPositionUpdateOption posUpdateOption);
function tryUpdatePosition(value, option, posUpdateOption)
Public Function TryUpdatePosition (value As Vector3, option As InteractionTrackerClampingOption, posUpdateOption As InteractionTrackerPositionUpdateOption) As Integer

Parameters

value
Vector3 Vector3

float3

The new position for the InteractionTracker.

option
InteractionTrackerClampingOption

A value that specifies how values are clamped to the maximum and minimum.

posUpdateOption
InteractionTrackerPositionUpdateOption

A value that specifies whether an already running custom scale animation should be allowed to continue running.

Returns

Int32

int

Returns the request ID. On state transitions, the request which caused the change in state will be included in the args. These IDs will start at 1 and increase with each try call during the lifetime of the application.

Attributes

Windows requirements

Device family
Windows 10, version 2004 (introduced in 10.0.19041.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v10.0)

Applies to

TryUpdatePosition(Vector3)

Tries to update the InteractionTracker's position.

The TryUpdatePosition method updates the location of InteractionTracker to the Vector3 position specified as a parameter. TryUpdatePosition is used to declaratively define the position of InteractionTracker at any point in time (either at start, from some state-entered event, etc.). TryUpdatePosition can be called from either the Idle, CustomAnimation or Inertia state – doing so will move the position of InteractionTracker to the defined position and enter the idle state.

public:
 virtual int TryUpdatePosition(float3 value) = TryUpdatePosition;
int TryUpdatePosition(float3 const& value);
public int TryUpdatePosition(Vector3 value);
function tryUpdatePosition(value)
Public Function TryUpdatePosition (value As Vector3) As Integer

Parameters

value
Vector3 Vector3

float3

The new position for the InteractionTracker.

Returns

Int32

int

Returns the request ID. On state transitions, the request which caused the change in state will be included in the args. These IDs will start at 1 and increase with each try call during the lifetime of the application.

Examples

void SetupInteractionTracker()
{
  // Setup InteractionTracker
  _tracker = InteractionTracker.Create(_compositor);
  _interactionSource.PositionXSourceMode = InteractionSourceMode.EnabledWithInertia;
  _interactionSource.PositionYSourceMode = InteractionSourceMode.EnabledWithInertia;

  _tracker.InteractionSources.Add(_interactionSource);
  _tracker.PositionInertiaDecayRate = new Vector3(0.95f);

  // Update the position of InteractionTracker, so doesn’t start at (0,0)
  _tracker.TryUpdatePosition(new Vector3(50f));
}

Remarks

If InteractionTracker is in its Interacting State (user actively manipulating), and TryUpdatePosition is called, the system will ignore this request – an event gets fired when this occurs that can be listened for. If sent from one of the other states, listen for the event fired for IdleStateEntered and check the RequestId property that identifies which request triggered the callback. The table below summarizes the expected behavior when this method is called in a particular state:

Current StateOutcome
IdleProperty updates to requested value, no state changes
InteractingRequest ignored
InertiaProperty updates to requested value, state changes to Idle
CustomAnimationProperty updates to requested value, state changes to Idle

Applies to

TryUpdatePosition(Vector3, InteractionTrackerClampingOption)

Tries to update the position of the InteractionTracker using the specified clamping option.

public:
 virtual int TryUpdatePosition(float3 value, InteractionTrackerClampingOption option) = TryUpdatePosition;
/// [Windows.Foundation.Metadata.Overload("TryUpdatePositionWithOption")]
int TryUpdatePosition(float3 const& value, InteractionTrackerClampingOption const& option);
[Windows.Foundation.Metadata.Overload("TryUpdatePositionWithOption")]
public int TryUpdatePosition(Vector3 value, InteractionTrackerClampingOption option);
function tryUpdatePosition(value, option)
Public Function TryUpdatePosition (value As Vector3, option As InteractionTrackerClampingOption) As Integer

Parameters

value
Vector3 Vector3

float3

The new position for the InteractionTracker.

option
InteractionTrackerClampingOption

A value that specifies how values are clamped to the maximum and minimum.

Returns

Int32

int

Returns the request ID. On state transitions, the request which caused the change in state will be included in the args. These IDs will start at 1 and increase with each try call during the lifetime of the application.

Attributes

Windows requirements

Device family
Windows 10, version 1809 (introduced in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v7.0)

Applies to