Showing results for 
Search instead for 
Did you mean: 

Caching an Avatar while offline / friendlier API for oculusUserID assignment?

Level 5
I'm currently getting a limited-functionality version of my company's app up and running with no internet connection available for remote demos. In this (fundamentally single player) version, you still have a first-person Avatar and a third-person one for when you look in a mirror. I'm caching all other media and dependencies on the local file system (this is on the Go, so it's a folder placed at the root storage/emulated/0/).
I'm wondering if there is a way to simply pull up a cached Avatar if you have no internet connection? It might not reflect the latest look registered under that oculusUserID with the Oculus Platform, but that doesn't matter. I noticed that there are .MT2, .TEX and .MESH files stored at storage/emulated/0/Oculus/Avatars. Is there some way we can just tell the OvrAvatar component to load those up on startup?
This leads me into a larger point which is that the automatic method for populating an Avatar, where you just have to make sure that you plug in a valid oculusUserID before you enable the GameObject, is pretty inflexible and unsatisfactory from an API standpoint. This should really be its own public method. Ideally it would even be re-assignable at runtime, but at the very least writing an initialization function called like RetrieveAvatar(string oculusUserID) would be preferable over setting a public string field and then enabling the GameObject.
Any suggestions for my first question?
Samsung Galaxy S8 (Snapdragon 835), Gear VR (2017), Oculus Go (64GB), Unity 2018.3.14f1

Level 4
Hi @cloud_canvas
We meet again!.

If i were to do that, i would pull it up like this:
  1. Record all packets,serialize them and write them every N seconds, like PhotonAvatarView.CS class
  2. Try to save the final mesh of the avatar somehow
  3. Load an empty avatar (grey dude), put the saved meshes replacing the corresponding parts
  4. Use a coroutine to read the saved packages every 0.3f seconds (like photon when it sends data)
  5. (optional) use a default cross platform avatar, i dont know (havent tested) if you can load an avatar asset without internet, if it is the default one in the in the cross platform test, it might just work anyway.
  6. (optional) use your own class to generate an avatar from the avatar data, there is a Avatar Material Manager our there.