SetAnimCurrentTime

From GECK
Jump to: navigation, search


A function added by the kNVSE Plugin.

Description

Sets an current time of the specified animation sequence. The current time allows you to control the time for the animation, effectively shifting it forward or backward in time.

Syntax

[help]
reference.SetAnimCurrentTime anim sequence path:string fCurrentTime:float

Example

Example 1: Freezing Animation Frame

player.SetAnimCurrentTime "Characters\Dance.kf" 1.1

This command will freeze the frame at 1.1 seconds into the 'Dance.kf' animation.

Example 2: Playing Animation Backwards

string_var sAnim = "Characters\MyAnim.kf"
player.SetAnimCurrentTime (sAnim) (player.GetAnimCurrentTime - GetSecondsPassed * 2)

In this script, GetSecondsPassed is multiplied by 2. This adjustment is necessary because the game engine will add the time delta to the offset each frame. Without this multiplication, the animation would remain static.

Important Note:

For both examples to work effectively, they must be invoked within the SetGameMainLoopCallback function and with the GameMode modeFlag active.

See Also