Skip to main content
bdstudio
Inspiring
April 24, 2023
Solved

Meta Avatar Animation - Help

I've managed to record and play Meta Avatar animation but there are problems because animation always gets stuck.

Here is part of the implementation:
I save modified PackedData every LateUpdate

 

 

 

PacketData packet = new PacketData();
packet.lod = lod;
packet.dataByteCount = SourceAvatar.RecordStreamData_AutoBuffer(lod, ref packet.data);

 

 

 

 when i want to play it, i simply interate through List of PacketData and call avatar.ApplyStreamData(data) every update or whenever i want. Everything works fine but animation always stops. There i also this warning popping up every 2-3 seconds or every second frame of data i read:

 

 

 

[ovrAvatar2 native] streaming::Snapshot remote time prediction exceeds one second. Jumping to new time.
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)

 

 

 

The animation always freezes when it starts playing it again, it unfreezes randomly when i decrease update from every frame to once every second. Or when i loop through my 300 frame animation, it only plays it perfectly for the first time and then freezes everytime and plays only last 100 frames. When i stop the playback the animation snaps to last frame after 1-2 seconds and then when i play again its unfreezed and ok. It happends in Editor with Oculus Link cable as well as in build on Oculus Quest 1 and Oculus Quest 2. Need advice on how to fix this, im guessing its related to said warning.

[Todays update]
Seems like playing the animation like "PingPong" doesnt freeze and throw much less "Snapshot remote time prediction" errors. I've extracted ovrAvatar2StreamingPlaybackState and there are couple of interesting variables: latestSampleTime, localTime, remoteTime, oldestSampleTime, recordingPlaybackTime, interpolationBlendWeight. I'm guessing the problem is as follows - some underlying system is analysing animation time and because this data is recorded it is messing with the timings so its trying to interpolate or something. The animation always breaks when subsequent frames playing are more than 30 frames apart.

    This topic has been closed for replies.
    bdstudio
    bdstudioAnswer
    Inspiring
    May 23, 2023

    Follow up!
    I miracleously solved the mystery (although its still work-around) but this time with no drawbacks.
    zeroing-out 2 values in avatar data apparently responsible for ovrAvatar2StreamingPlaybackState.remoteTime
    these two values indexes are 12 and 13 (in all low/medium/high data types)

    3 replies

    bdstudio
    bdstudioAuthorAnswer
    Inspiring
    May 23, 2023

    Follow up!
    I miracleously solved the mystery (although its still work-around) but this time with no drawbacks.
    zeroing-out 2 values in avatar data apparently responsible for ovrAvatar2StreamingPlaybackState.remoteTime
    these two values indexes are 12 and 13 (in all low/medium/high data types)

    Participant
    June 23, 2023
    ovrAvatar2StreamingPlaybackState

    Thanks to bdstudio for this workaround. Here's a concrete example of how to implement it. 

    byte[] firstBytesInList = _animationQueue[animationFrame];

    firstBytesInList[12] = 0;
    firstBytesInList[13] = 0;

    if (firstBytesInList != null)
    {

    avatarGameObject.GetComponent<SampleAvatarEntity>().ApplyStreamData(firstBytesInList);

    }