InteractionTracker.TryUpdateScaleWithAdditionalVelocity Method

Definition

Tries to update the scale by adding the specified velocity.

The TryUpdateScaleWithAdditionalVelocity method adds the inputted scalar representing additional velocity to the current velocity of InteractionTracker as well as shifts the centerpoint to the inputted Vector3. As a result, because the velocity of InteractionTracker has now changed, the targeted rest scale position for InteractionTracker now changes. TryUpdateScaleWithAdditionalVelocity can be called from either Idle, Inertia or CustomAnimation states – doing so will either add or update the velocity of InteractionTracker and enter the Inertia state.

public:
 virtual int TryUpdateScaleWithAdditionalVelocity(float velocityInPercentPerSecond, float3 centerPoint) = TryUpdateScaleWithAdditionalVelocity;
int TryUpdateScaleWithAdditionalVelocity(float const& velocityInPercentPerSecond, float3 const& centerPoint);
public int TryUpdateScaleWithAdditionalVelocity(float velocityInPercentPerSecond, Vector3 centerPoint);
function tryUpdateScaleWithAdditionalVelocity(velocityInPercentPerSecond, centerPoint)
Public Function TryUpdateScaleWithAdditionalVelocity (velocityInPercentPerSecond As Single, centerPoint As Vector3) As Integer

Parameters

velocityInPercentPerSecond
Single

float

The velocity to add to the scale.

centerPoint
Vector3 Vector3

float3

The new center point.

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

// Listen for the InertiaStateEntered event
public void InertiaStateEntered(InteractionTracker sender, 	InteractionTrackerInertiaStateEnteredArgs args)
{
  // Adding velocity to InteractionTracker if condition met
  if (_extraVelocityNeeded)
  {
    // Adding velocity to the scale motion.
    _tracker.TryUpdateScaleWithAdditionalVelocity(3.0f, new Vector3(75f));
  }
}

Remarks

If InteractionTracker is in its Interacting State (user actively manipulating), and TryUpdateScaleWithAdditionalVelocity 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 InertiaStateEntered 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
IdleState changes to inertia and inertia modifiers are evaluated with requested velocity as initial velocity
InteractingRequest ignored
InertiaInertia is restarted (state re-enters inertia) and inertia modifiers are evaluated with requested velocity added to current velocity
CustomAnimationCurrent animation stops and state changes to inertia with inertia modifiers evaluated using requested velocity as initial velocity

Applies to