cancel
Showing results for 
Search instead for 
Did you mean: 

Add animation to Avatar in Unity

GoranRiddle
Explorer

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?

6 REPLIES 6

olaysia
Expert Protege

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.

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

VladimirGrygoriev
Honored Guest

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
Explorer

 

[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
Explorer

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)

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!