cancel
Showing results for 
Search instead for 
Did you mean: 

Does Oculus Quest support Photon Unity Networking?

mofvr
Honored Guest
I am researching about possibilities to make multi user experiences for the Quest and have been wondering if Photon would help?
26 REPLIES 26

cloud_canvas
Expert Protege

VJ76 said:



re: idiosyncrasies of local vs remote players using Oculus Avatars SDK and PUN 2:



Thx! @cloud_canvas, did you use it yourself? i have experience in developing vr, but i'm new to networking.



Yep, if you look at the bottom of the page there's an addendum crediting me, lol. I've had a lot of back and forth with Tobias and Jean from Photon specifically about Oculus Avatar serialization. Please search for "Oculus Avatars" and "PUN" or "Photon" and you will see loads about this on this forum.

cloud_canvas
Expert Protege
My company's Oculus Go app has extensive integration with PUN 2 and Oculus Avatars. I am also totally new to networking. I'd recommend simply following Photon's basic tutorials and then applying the concepts (PhotonView, RPC, RaiseEvent etc.) to your own project.

paulodgn
Honored Guest
@cloud_canvas First thanks for all the research and to share the fix with photon and Avatars. I did what it says in the Photon tutorial for the avatars but im having a problem. The avatar never gets Initialized for some reason and i dont get any errors. Any idea in what can be the cause of this?

MassiveState
Protege
Hey I'm currently in the process of working with pun2 and avatars as well.

I realized the OnJoinedRoom() function wasn't being called when instantiating the avatars so I changed it to a LoadAvatar() function and called it just after I created the player. 

This is my NetworkManager.cs script:


private void Start()
{
CreatePlayer();
LoadAvatar();
}

//here's my create player script

public byte InstantiateVrAvatarEventCode = 123;

public void LoadAvatar()
{
GameObject localAvatar = Instantiate(Resources.Load("PUN_LocalAvatar")) as GameObject;
PhotonView photonView = localAvatar.GetComponent<PhotonView>();

//Make avatar child of PUNPlayer
localAvatar.transform.parent = player.transform;

//Center avatar on PUNPlayer
localAvatar.transform.localPosition = Vector3.zero;
localAvatar.transform.localRotation = Quaternion.identity;


if (PhotonNetwork.AllocateViewID(photonView))
{
RaiseEventOptions raiseEventOptions = new RaiseEventOptions
{
CachingOption = EventCaching.AddToRoomCache,
Receivers = ReceiverGroup.Others
};

SendOptions sendOptions = new SendOptions
{
Reliability = true
};

PhotonNetwork.RaiseEvent(InstantiateVrAvatarEventCode, photonView.ViewID, raiseEventOptions, sendOptions);
Debug.Log("Raised Event Set: " + photonView.ViewID + " | " + raiseEventOptions + " | " + sendOptions);
}
else
{
Debug.LogError("Failed to allocate a ViewId.");

Destroy(localAvatar);
}
}
But now it seems like my event data for RemoteAvatar not being sent, here's my CallBack.cs script:
public class EventCallbacks : MonoBehaviourPunCallbacks, IOnEventCallback
{

public byte InstantiateVrAvatarEventCode = 123;

public override void OnEnable()
{
PhotonNetwork.AddCallbackTarget(this);
}

public override void OnDisable()
{
PhotonNetwork.RemoveCallbackTarget(this);
}

public void OnEvent(EventData photonEvent)
{
if (photonEvent.Code == InstantiateVrAvatarEventCode)
{
GameObject remoteAvatar = Instantiate(Resources.Load("PUN_RemoteAvatar")) as GameObject;
PhotonView photonView = remoteAvatar.GetComponent<PhotonView>();
photonView.ViewID = (int)photonEvent.CustomData;

Debug.Log("Remote Avatar Instantiated");
}
}
}
Maybe I have it on the wrong GameObject or I'm putting everything in the wrong places (I have no clue). It would be helpful if the photon documentation specified "Create a script for ______ and attach it to ______". I did implement @cloud_canvas's OVRAvatar.cs hack but I'm not even getting the callback error. 

@paulodgn I feel we can put our heads together and figure it out, maybe @cloud_canvas can help us  😉

paulodgn
Honored Guest
@"justin.oheir" i fixed my issue. The problem was cloud OVRAvatar fix. The avatar was never initialiazed, so i removed that part of the code and it works good now. For the rest of it i followed the tutorial from Photon and everything works.
Did you follow that guide? https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/oculusavatarsdk

paulodgn
Honored Guest
@"justin.oheir" Regarding the gameobjects you should have something like this for the LocalAvatar:

qsjb9c5ggvsf.png

Make sure that the object in the Observed Component is the Photon Avatar View (marked in red). Hope it helps, im no expert, just starting with Photon also.

MassiveState
Protege
@justin.oheir i fixed my issue. The problem was cloud OVRAvatar fix. The avatar was never initialiazed, so i removed that part of the code and it works good now. For the rest of it i followed the tutorial from Photon and everything works.
Did you follow that guide? https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/oculusavatarsdk
Yea I'm following that tutorial. Thanks a bunch! 

So I have achieved a grey avatar with no hands that doesn't move with the headset, I just removed TransformView from the PhotonView based on your set-up. I have a feeling that will fix my movement problem, come on hands! (also do you have the same scripts on the RemoteAvatar?@paulodgn

paulodgn
Honored Guest
@"justin.oheir" Yes the remote avatar has the same setup

For the hands to work i believe you have to set an app ID on the Avatar settings:

chkug28v3hvk.png

MassiveState
Protege
Yea I have those set. hmm

pyruss
Honored Guest
Would any kind soul, share  very simplistic / basic scripts on what currently work with oculus quest 7.0 + Pun2? modeler & animator with very basic scripting knowledge and 2 days of networking survey.
I am following the photon tutorials , got it to work with regular networking but as soon as i try to add the avatar portion, all hell breaks lose and nothing works, it doesnt even let me add "IOneventCallback" to the network manager script (that uses in regular tutorial)