External pauses

Previous section < Rezzing

- Chapter : More details -

This page provides a few technical details of the modifications introduced in v2.2 to (try to) enhance compatibility with other scripts that may pause a keyframed motion independently of MvtPlayer. This is what avSitter does when a new pose is selected, and of course similar systems might want to do the same.

What is it about?

This is legitimate concern because when a smooth movement (keyframed motion) is playing, any attempt at direct positioning will fail with a script error. Hence the KFM 1 directive mentioned about avSitter: the solution is to pause the motion, perform the direct positioning and then resume the motion.

Why is this a problem?

Actually there are two problems with this approach.

  1. Pausing the motion triggers the moving_end() event, which the MvtPlayer uses to detect the end of a keyframed motion. This may lead it to think the smooth movement step has ended and prematurely start the next step in the sequence. We have a workaround mentioned below.

  2. Un-pausing the motion will resume the keyframed motion, even if MvtPlayer had paused it on purpose! Sadly there is nothing we can do here without further help from AVsitter (or other) itself. See at the end of this page for a discussion about this. Luckily this situation is not very likely to happen and should not cause serious problems if it happens.

Working around

In version 2.2 some code was added inside MvtPlayer to determine if a moving_end() event is "likely" to signal the end of a keyframed motion step (in order to start the next step in the sequence) or the result of an external pause. This is done by comparing the expected time for the end of the step with the current time, which is precise up to the second (but may be affected by sim lag).

In the latter case, the MvtPlayer will wait for a corresponding moving_start() to assume playback has resumed and thus adjust the expected time setting. Again this is not perfect but should work around what some may call a design flaw in the keyframed motion system.

Limitations

Regarding problem #2 mentioned above, the best solution would be that the external pause is triggered only when required, that is when the motion is not already paused. This can be done by a script detecting the MVTSTATUS message from MvtPlayer that indicates when the motion is paused or unpaused.

Such adaptations are beyond MvtPlayer's scope, but deas regarding this are welcome. As said above, this is not very serious of an issue.