Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

How Can I Implement Doppelganger Avatars?

AeonAeon Posts: 3
NerveGear
Hello everyone,
In the program I'm working on, I want the player to be present inside their avatar in first person as well as able to see and interact with a smaller version of themselves in the third person. In general, I have this working (based on one of the example scenes, I have two LocalAvatars present). I can see myself moving, and the smaller version moving in parallel. However, when I set the OculusUserID of both LocalAvatar instances to my account ID, only one instance of LocalAvatar gets the correct mesh and material from my account (whichever is loaded first). The other one appears as the default ghostly white bald avatar.

How can I have more than one instance of LocalAvatar, each with my own OculusUserID. Or else, how can I trick the subsequent clone LocalAvatars into appearing the same as the first person version that has my ID? It appears as though the rendered materials for each part are generated dynamically through a complex chain of events.

Thanks!

Edit: I changed the name. Originally it looked informative, rather than inquisitive. Sorry!

Comments

  • DigibixDigibix Posts: 17 Oculus Start Member
    Try changing the local avatar objects to inactive at first.

    For example add the local avatar prefab to your scene... on the Ovr Avatar Script on the inspector disable the script.

    After you update the OculusUserID, enable the Ovr Avatar Script:

    public OvrAvatar myAvatar1;  //LOCAL AVATAR
    public OvrAvatar myAvatar2;  //TINY 3PERSON AVATAR
    
    .... ENTITLEMENT MANAGEMENT CODE....
    
    private void GetLoggedInUserCallback(Message msg)  //GET THE VALID USER ID
        {
            if (!msg.IsError)
            {
                User u = msg.GetUser();
                Debug.Log(u.OculusID);
    
                myAvatar1.oculusUserID = u.ID;
                myAvatar1.enabled = true; //ENABLE THE OVRAVATAR SCRIPT
    
                myAvatar2.oculusUserID = u.ID;
                myAvatar2.enabled = true;
            
            }
        }

    Remember to disable the Ovr Avatar Script on the Inspector.

    The problem seems to be that sometime the OVR Avatar scripts Start() funcion run before you can change the oculusUserID..... by disabling the component, you can set the id before it's start.
Sign In or Register to comment.