Skip to main content
New Participant
January 12, 2023

Add animation to Avatar in Unity

I want to use avatars from Meta SDK as NPCs in an experience that I'm developing, using some Mixamo animations to make them look more alive. However I can't find a way to add an Animator controller to the OVRAvatarEntities.

Has anyone done this?

This topic has been closed for replies.

6 replies

Inspiring
January 12, 2023

I think there might be a simpler way of doing this.

  1. Use OvrAvatarEntity.RecordStreamData() to record yourself doing some animations.

  2. Use OvrAvatarEntity.ApplyStreamData() to apply those same animations onto your NPC character.
New Participant
January 12, 2023

Didn't think of that. Do you have a tutorial, documentation or something that shows the basic usage of RecordStreamData?

New Participant
March 16, 2023

HI, guys!

Did you find some workable solution with OvrAvatarEntity.RecordStreamData()  and OvrAvatarEntity.ApplyStreamData()? I tried several variants and all of them are failed. I have a lot of warnings about "Failed to apply stream data" and "assertion failed".

bdstudio
Inspiring
May 23, 2023

 

[Unity]
Check out SampleRemoteLoopbackManager.cs
 
Record data in LateUpdate or coroutine every 0.X second, depends on how dense data you want:

 

PacketData packet = new PacketData();
packet.lod = lod;
packet.dataByteCount = SourceAvatar.RecordStreamData_AutoBuffer(lod, ref packet.data);
if (lod == recordLOD || recordLOD == StreamLOD.Full)
recordedAvatarData.Data.Add(packet);
// recordedAvatarData.Data is scriptable struct for holding list of PacketData


//Read data (preferably in LateUpdate but depending on your needs):
// iterate over your recordedAvatarData.Data
if (packet.lod == recordLOD || recordLOD == StreamLOD.Full)
loopbackAvatar.ApplyStreamData(data);

 

 

The only problem with this approach is: you can not loop animation, it always breaks. Currently only workaround i found is to play it using ping-pong (from beginning to the end, then from end to beginning)

bdstudio
Inspiring
May 23, 2023

Small update!

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)

New Participant
January 30, 2024

Very appreciate your work!
I am curious that how do you find out 12&13 are indexes responsible for ovrAvatar2StreamingPlaybackState.remoteTime?
Since I didn't find a way to decompose PacketData.data structure
Thanks!