Delen via


InteractionTracker.TryUpdatePositionBy Method

Definition

Overloads

TryUpdatePositionBy(Vector3)

Tries to adjust the InteractionTracker's position by the specified amount.

The TryUpdatePositionBy method updates the current location of InteractionTracker by the Vector3 delta specified as a parameter. Similarly to TryUpdatePosition, TryUpdatePositionBy is used to declaratively move InteractionTracker by a defined delta without the need of an animation or Inertia. TryUpdatePositionBy can be called from either the Idle, CustomAnimation or Inertia state – doing so will move the position of InteractionTracker by the defined delta and enter the idle state.

TryUpdatePositionBy(Vector3, InteractionTrackerClampingOption)

Tries to adjust the position of the InteractionTracker by the specified amount using the specified clamping option.

TryUpdatePositionBy(Vector3)

Tries to adjust the InteractionTracker's position by the specified amount.

The TryUpdatePositionBy method updates the current location of InteractionTracker by the Vector3 delta specified as a parameter. Similarly to TryUpdatePosition, TryUpdatePositionBy is used to declaratively move InteractionTracker by a defined delta without the need of an animation or Inertia. TryUpdatePositionBy can be called from either the Idle, CustomAnimation or Inertia state – doing so will move the position of InteractionTracker by the defined delta and enter the idle state.

public:
 virtual int TryUpdatePositionBy(float3 amount) = TryUpdatePositionBy;
int TryUpdatePositionBy(float3 const& amount);
public int TryUpdatePositionBy(Vector3 amount);
function tryUpdatePositionBy(amount)
Public Function TryUpdatePositionBy (amount As Vector3) As Integer

Parameters

amount
Vector3 Vector3

float3

The value to add to the current position.

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

public void InertiaStateEntered(InteractionTracker sender, 	InteractionTrackerInertiaStateEnteredArgs args)
{
  // For sample purpose, will overwrite Inertia motion definitions by moving InteractionTracker to a specified position based on a delta
  _tracker.TryUpdatePositionBy(new Vector3(50f));}
}

Remarks

If InteractionTracker is in its Interacting State (user actively manipulating), and TryUpdatePositionBy 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

TryUpdatePositionBy(Vector3, InteractionTrackerClampingOption)

Tries to adjust the position of the InteractionTracker by the specified amount using the specified clamping option.

public:
 virtual int TryUpdatePositionBy(float3 amount, InteractionTrackerClampingOption option) = TryUpdatePositionBy;
/// [Windows.Foundation.Metadata.Overload("TryUpdatePositionByWithOption")]
int TryUpdatePositionBy(float3 const& amount, InteractionTrackerClampingOption const& option);
[Windows.Foundation.Metadata.Overload("TryUpdatePositionByWithOption")]
public int TryUpdatePositionBy(Vector3 amount, InteractionTrackerClampingOption option);
function tryUpdatePositionBy(amount, option)
Public Function TryUpdatePositionBy (amount As Vector3, option As InteractionTrackerClampingOption) As Integer

Parameters

amount
Vector3 Vector3

float3

The value to add to the current position.

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