Partager via


SetPhysicsEngineUserTime (Compact 2013)

3/28/2014

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

You must create the physics engine in PHYSICSENGINE_FLAG_USERTIME mode to use this function.

Syntax

HRESULT SetPhysicsEngineUserTime(
    HPHYSICSENGINE hEngine,
   DWORD dwTime
);

Parameters

  • hEngine
    [in] A handle to the physics engine object.
  • dwTime
    [in] The time stamp, in milliseconds, from the start of the animation.

Return Value

  • 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 you create the physics engine in PHYSICSENGINE_FLAG_USERTIME mode, the time is set to 0 (zero).

You must call SetPhysicsEngineTime with a time stamp that is greater than the current time stamp of the physics engine, otherwise the physics engine calculates incorrect stopping points for the animation.

Requirements

Header

physicsengine.h,
winuser.h

sysgen

SYSGEN_PHYSICSENGINE

See Also

Reference

Physics Engine Functions
Touch Gestures Physics Engine Reference