Share via


TKSetPhysicsEngineUserTime

4/8/2010

This function sets the current timestamp of the physics engine object in relation to the start of an animation. You can use this function to simulate a set time sequence of steps, for example checking an animation plan, or reproducing specific testing conditions.

The physics engine must be created in PHYSICSENGINE_FLAG_USERTIME mode to use this function.

Syntax

HRESULT TKSetPhysicsEngineUserTime(
    HPHYSICSENGINE hEngine,
   DWORD dwTime
);

Parameters

  • hEngine
    [in] A handle to the physics engine object.
  • dwTime
    [in] The timestamp in milliseconds relative to the start of the animation.

Return Value

The return value can contain the following values. It may also return other values and should be tested using the SUCCEEDED and FAILED macros.

  • S_OK
    Indicates that the physics engine time is successfully set.
  • E_INVALIDARG
    Indicates that the hEngine handle is invalid.
  • E_UNEXPECTED
    Indicates that the physics engine is not in PHYSICSENGINE_FLAG_USERTIME mode.

Remarks

When the physics engine is created in PHYSICSENGINE_FLAG_USERTIME mode, the time is set to 0 (zero).

You must call TKSetPhysicsEngineUserTime with a timestamp that is greater than the current timestamp of the physics engine, otherwise the physics engine may calculate incorrect stopping points for the animation.

Requirements

Header GesturePhysicsEngine.h

See Also

Other Resources

Physics Engine Functions (DTK)