homer987
homer98710mo ago

meta Avatar configuration

Hey all, been working on this for ages and really cant figure out what the issue is. I need you!! Been trying to use meta avatars with Normcore and In the following script, i am trying to stream the data of my local avatar to the remote avatar. the local avatar's movements is mimicking my camera rig. The issue is that when i connect 2 players, the "remote avatars" flicker between two states. the first being a mimicry of the local avatar and the second being the other player's avatar movements. i have the two avatars attached to this script, and they are both in the scene hierarchy. Been at it for days and have no idea what the issue could be, anyone have any ideas why this could be happening? Here is what the script looks like, pretty straight forward, no idea what's causing this problem. cant paste the script coz i dont have nitro but here it is. Im dying for help!!
Solution:
Meta avatars now available with normcore! https://normcore.io/documentation/guides/meta/meta-avatars-setup...
Meta Avatars Setup | Normcore Documenation
Normal and Meta have worked together to provide rich prebuilt avatars that work with Normcore out of the box. This guide will demonstrate how to use the built-in MetaAvatar component to set up networked meta avatars with voice chat in a few minutes.
Jump to solution
13 Replies
kapa.ai
kapa.ai10mo ago
Hi @homer987. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but without the actual script or more specific details about your implementation, it's difficult to provide a precise solution. However, based on the information provided in the knowledge sources, here are a few things you might want to check: 1. Ownership: In Normcore, scripts that live on the avatar prefab are instantiated for each avatar, not just the local player. This means that your code will execute on local and remote avatars, once for every player in the scene. If you want logic to only apply to a single player, you should use the isOwnedLocallyInHierarchy property of the RealtimeView component. This might be the reason why your remote avatars are flickering between two states. More info here (https://normcore.io/documentation/realtime/common-questions#i-have-a-script-on-my-player-why-is-it-updating-all-players-in-the-room) 2. RealtimeTransform: If you're using RealtimeTransform to synchronize the movements of your avatars, make sure that it has an owner. If a RealtimeTransform gets stuck or behaves unexpectedly, calling RequestOwnership() might help. More info here (https://normcore.io/documentation/realtime/common-questions#my-realtimetransform-gets-stuck-and-i-cant-move-it-what-can-i-do-about-this) 3. Avatar Prefabs: Make sure that your avatar prefabs are set up correctly. Normcore includes a set of built-in scripts that can be used to create XR avatars quickly. You might want to start with the XR Avatars and Voice Chat (https://normcore.io/documentation/guides/xr-avatars-and-voice-chat) guide to ensure that your avatars are set up correctly. If you're still having trouble, I would recommend reaching out to the Normcore community or support for more specific help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@862508759270817864> kapa.ai is still learning and improving, please let us know how it did by reacting below
homer987
homer987OP10mo ago
@Normcore Assistant here is the script
private byte[] byteArray = new byte[0];
public OvrAvatarEntity localEntity;
public OvrAvatarEntity remoteEntity;
public SampleAvatarEntity sampleAvatarEntity;

private bool remoteLoaded = false;
public bool isLocal = true;

private Realtime _realtime;
private bool connectedToRoom = false;
private bool avatarFound = false;

private RealtimeAvatarManager _manager;

private void Awake()
{
localEntity.OnUserAvatarLoadedEvent.AddListener(OnUserAvatarLoaded);
remoteEntity.OnUserAvatarLoadedEvent.AddListener(OnUserAvatarLoadedRemote);

_realtime = GetComponent<Realtime>();
_manager = GetComponent<RealtimeAvatarManager>();
_realtime.didConnectToRoom += DidConnectToRoom;
}
protected override void OnRealtimeModelReplaced(StreamDataModel previousModel, StreamDataModel currentModel)
{
if (previousModel != null)
{
previousModel.avatarAnimationDataDidChange -= OnAvatarAnimationDataChanged;
}
if (currentModel != null)
{
currentModel.avatarAnimationDataDidChange += OnAvatarAnimationDataChanged;
}
}

private void OnAvatarAnimationDataChanged(StreamDataModel model, byte[] data)
{
if (!avatarFound) return;
if (!remoteLoaded) return;
remoteEntity.ApplyStreamData(model.avatarAnimationData);
}

private void OnUserAvatarLoaded(OvrAvatarEntity avatarEntity)
{
StartCoroutine(StreamAvatarData(avatarEntity));
}

private void OnUserAvatarLoadedRemote(OvrAvatarEntity avatarEntity)
{
remoteLoaded = true;
}

private IEnumerator StreamAvatarData(OvrAvatarEntity avatarEntity)
{
while (true)
{
model.avatarAnimationData = localEntity.RecordStreamData(StreamLOD.Low);
yield return new WaitForSecondsRealtime(0.1f);
}
}
private byte[] byteArray = new byte[0];
public OvrAvatarEntity localEntity;
public OvrAvatarEntity remoteEntity;
public SampleAvatarEntity sampleAvatarEntity;

private bool remoteLoaded = false;
public bool isLocal = true;

private Realtime _realtime;
private bool connectedToRoom = false;
private bool avatarFound = false;

private RealtimeAvatarManager _manager;

private void Awake()
{
localEntity.OnUserAvatarLoadedEvent.AddListener(OnUserAvatarLoaded);
remoteEntity.OnUserAvatarLoadedEvent.AddListener(OnUserAvatarLoadedRemote);

_realtime = GetComponent<Realtime>();
_manager = GetComponent<RealtimeAvatarManager>();
_realtime.didConnectToRoom += DidConnectToRoom;
}
protected override void OnRealtimeModelReplaced(StreamDataModel previousModel, StreamDataModel currentModel)
{
if (previousModel != null)
{
previousModel.avatarAnimationDataDidChange -= OnAvatarAnimationDataChanged;
}
if (currentModel != null)
{
currentModel.avatarAnimationDataDidChange += OnAvatarAnimationDataChanged;
}
}

private void OnAvatarAnimationDataChanged(StreamDataModel model, byte[] data)
{
if (!avatarFound) return;
if (!remoteLoaded) return;
remoteEntity.ApplyStreamData(model.avatarAnimationData);
}

private void OnUserAvatarLoaded(OvrAvatarEntity avatarEntity)
{
StartCoroutine(StreamAvatarData(avatarEntity));
}

private void OnUserAvatarLoadedRemote(OvrAvatarEntity avatarEntity)
{
remoteLoaded = true;
}

private IEnumerator StreamAvatarData(OvrAvatarEntity avatarEntity)
{
while (true)
{
model.avatarAnimationData = localEntity.RecordStreamData(StreamLOD.Low);
yield return new WaitForSecondsRealtime(0.1f);
}
}
kapa.ai
kapa.ai10mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Based on the script you've provided, it seems like you're trying to stream avatar data from a local avatar to a remote avatar. Here are a few things you might want to check: 1. Ownership: In Normcore, scripts that live on the avatar prefab are instantiated for each avatar, not just the local player. This means that your code will execute on local and remote avatars, once for every player in the scene. If you want logic to only apply to a single player, you should use the isOwnedLocallyInHierarchy property of the RealtimeView component. This might be the reason why your remote avatars are flickering between two states. More info here (https://normcore.io/documentation/realtime/common-questions#i-have-a-script-on-my-player-why-is-it-updating-all-players-in-the-room) 2. RealtimeAvatarManager: The RealtimeAvatarManager is a component that lives in the scene on the same game object as your Realtime instance. It is responsible for instantiating an avatar prefab to represent the local player as well as keeping track of avatars that were instantiated for other players in the same room. You might want to check if you're using this component correctly. More info here (https://normcore.io/documentation/realtime/xr/avatars#realtimeavatarmanager) 3. Data Streaming: In your StreamAvatarData coroutine, you're continuously updating the avatarAnimationData of the model. This might be causing the flickering effect if the data is not being updated correctly. You might want to check if the RecordStreamData method is returning the correct data and if the ApplyStreamData method is applying it correctly. 4. Remote Avatar Loading: You're using a remoteLoaded boolean to check if the remote avatar has loaded before applying the stream data. You might want to check if this boolean is being set correctly in the OnUserAvatarLoadedRemote method. If you're still having trouble, I would recommend reaching out to the Normcore community or support for more specific help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@862508759270817864> kapa.ai is still learning and improving, please let us know how it did by reacting below
maxweisel
maxweisel10mo ago
It sounds like your local avatar is getting a change notification for the avatar data changing and applying it to itself. also, we’re about two weeks or so away from shipping a meta avatar component that will do everything for you. If you sit tight, we’ll have that out soon. And it sets up lip sync, finger tracking, the works. and reduces the allocations that folks create with a lot of the guides out there
homer987
homer987OP10mo ago
@Normcore Assistant The situation is one where the avatar is rapidly switching between its own movements and the streamed movements from another player, leading to the observed flickering. Here is additional information about my set up: i have the local avatar in the scene and attached to the script I gave you. this avatar is mimicking the movement of the ovr camera rig. then i have the remote avatar which is also in the scene ( local and remote avatar for me are just a naming convention to differentiate between the two. but they are the same object in terms of settings, just being assigned to do different things from the script). i then drag these two avatars to the script. and then the flickering happens. is there anything in the script that points to what you said about situation where the avatar is rapidly switching between its own movements and the streamed movements from another player, leading to the observed flickering?
kapa.ai
kapa.ai10mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Based on your setup and the script you've provided, it seems like the issue might be related to how you're handling the avatar data streaming. In your StreamAvatarData coroutine, you're continuously updating the avatarAnimationData of the model. This might be causing the flickering effect if the data is not being updated correctly or if there's a conflict between the local and remote avatar data. Here are a few things you might want to check: 1. Data Streaming: You're continuously updating the avatarAnimationData of the model in the StreamAvatarData coroutine. This might be causing the flickering effect if the data is not being updated correctly. You might want to check if the RecordStreamData method is returning the correct data and if the ApplyStreamData method is applying it correctly. 2. Local and Remote Avatars: You mentioned that you have both a local and a remote avatar in the scene, and they're both the same object in terms of settings. This might be causing a conflict if both avatars are trying to apply their own movements and the streamed movements from the other player at the same time. You might want to check if there's a conflict between the local and remote avatar data. 3. Avatar Ownership: In Normcore, scripts that live on the avatar prefab are instantiated for each avatar, not just the local player. This means that your code will execute on local and remote avatars, once for every player in the scene. If you want logic to only apply to a single player, you should use the isOwnedLocallyInHierarchy property of the RealtimeView component. This might be the reason why your remote avatars are flickering between two states. More info here (https://normcore.io/documentation/realtime/common-questions#i-have-a-script-on-my-player-why-is-it-updating-all-players-in-the-room) If you're still having trouble, I would recommend reaching out to the Normcore community or support for more specific help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@862508759270817864> kapa.ai is still learning and improving, please let us know how it did by reacting below
homer987
homer987OP10mo ago
@Normcore Assistant in regards to avatar ownership, the script is not on the avatar prefab but rather attached to the Realtime + VR Player gameObject
kapa.ai
kapa.ai10mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- In Normcore, the RealtimeAvatarManager is typically attached to the Realtime game object and is responsible for managing avatar prefabs. If your script is attached to the Realtime + VR Player game object, it's important to ensure that the avatar ownership is correctly set up. The RealtimeAvatarManager instantiates an avatar prefab to represent the local player and keeps track of avatars that were instantiated for other players in the same room. If the component is enabled and realtime is connected to a room, an avatar prefab represented by the localAvatarPrefab property will be instantiated to represent the local client. This prefab needs to include a RealtimeAvatar component on the root in order to function correctly. If you want logic to only apply to a single player, you should use the isOwnedLocallyInHierarchy property of the RealtimeView component. This might be the reason why your remote avatars are flickering between two states. Here's an example of how to use the avatarCreated and avatarDestroyed events of RealtimeAvatarManager:
using UnityEngine;
using Normal.Realtime;

public class MyAvatarManager : MonoBehaviour {
private RealtimeAvatarManager _manager;

private void Awake() {
_manager = GetComponent<RealtimeAvatarManager>();
_manager.avatarCreated += AvatarCreated;
_manager.avatarDestroyed += AvatarDestroyed;
}

private void AvatarCreated(RealtimeAvatarManager avatarManager, RealtimeAvatar avatar, bool isLocalAvatar) {
// Avatar created!
}

private void AvatarDestroyed(RealtimeAvatarManager avatarManager, RealtimeAvatar avatar, bool isLocalAvatar) {
// Avatar destroyed!
}
}
using UnityEngine;
using Normal.Realtime;

public class MyAvatarManager : MonoBehaviour {
private RealtimeAvatarManager _manager;

private void Awake() {
_manager = GetComponent<RealtimeAvatarManager>();
_manager.avatarCreated += AvatarCreated;
_manager.avatarDestroyed += AvatarDestroyed;
}

private void AvatarCreated(RealtimeAvatarManager avatarManager, RealtimeAvatar avatar, bool isLocalAvatar) {
// Avatar created!
}

private void AvatarDestroyed(RealtimeAvatarManager avatarManager, RealtimeAvatar avatar, bool isLocalAvatar) {
// Avatar destroyed!
}
}
More info here (https://normcore.io/documentation/realtime/xr/avatars#realtimeavatarmanager) If you're still having trouble, I would recommend reaching out to the Normcore community or support for more specific help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@862508759270817864> kapa.ai is still learning and improving, please let us know how it did by reacting below
Solution
Towellie
Towellie9mo ago
Meta Avatars Setup | Normcore Documenation
Normal and Meta have worked together to provide rich prebuilt avatars that work with Normcore out of the box. This guide will demonstrate how to use the built-in MetaAvatar component to set up networked meta avatars with voice chat in a few minutes.

Did you find this page helpful?