Closed enes-oerdek closed 4 years ago
Is it possible for you to put your avatar prefab in the config Scriptable Object? It is important that the avatar prefab is instantiated nested in the OVRCameraRig.
For custom locomotion that should be supported, but you should be moving the OVRCameraRig directly.
Don't know if you got notified @enesbil, so I'm pinging you here.
Hey provencher, excuse me for my late reply.
If you mean by config scriptable object the MRTK-OculusConfig File, I already added the MRTK-Quest-Prefabs to this. And this issue is somehow strange. I see here, that the localavatar object is added to trackingspace:
GameObject.Instantiate(MRTKOculusConfig.Instance.LocalAvatarPrefab, cameraRig.trackingSpace);
But strangely, it is not. It is added into the Scene Hierarchy right into the root. Here's a screenshot:
Even if I add the localavatar manually into trackingspace, it is still spawned, like seen here:
Is probably my scene setup wrong?
@enesbil resolved this issue in https://github.com/provencher/MRTK-Quest/pull/41
Hello again! I might have found an issue, which could be an unexpected behaviour. The general approach for adding Oculus avatars and camera into the scene is by adding an OVR Camera Rig, and adding a LocalAvatar into "TrackingSpace" in the Camera Rig. In my specific case I needed to have it this way, because i don't want to track position of LocalAvatar and CameraRig seperately (when e.g. implementing some custom locomotion approach).
After starting the application, another LocalAvatar is added into the scene and this behaviour is unexpected, since in most cases we only want to have one localavatar. We easily find out the reason. In MRTKOculusConfig.cs we find this:
/// <summary> /// Prefab reference for LocalAvatar to load, if none are found in scene. /// </summary> public GameObject LocalAvatarPrefab => localAvatarPrefab;
The comment and actual behaviour differ from each other. This object is used and initialized in OculusQuestInputManager.cs without further checking whether this object already exists:
if (useAvatarHands) { // Initialize the local avatar controller GameObject.Instantiate(MRTKOculusConfig.Instance.LocalAvatarPrefab, cameraRig.trackingSpace); }
In my project I just commented out the initializing of the game object. This is of course not a permanent solution. Probably one good approach might be to leave handling of LocalAvatar fully to the developer and remove initializing it in the InputManager.
Kind regards, Enes