msub2 / silk-brush-2021

An effort to port Tilt Brush to WebXR.
Apache License 2.0
47 stars 5 forks source link

No way to retrieve HMD info to set controllers yet #5

Closed msub2 closed 3 years ago

msub2 commented 3 years ago

Previously, native versions would get this information from whatever runtime they were using (Oculus, SteamVR, etc) but that's no longer an option. Currently I'm forcing it to WMR for my own testing, but it should be possible to pull the input profile from the XRSession on either an XRInputSourceEvent or an XRInputSourcesChange event, and hold off on setting the model until then.

msub2 commented 3 years ago

This can actually be pulled from WebXRController with GetProfiles(), just need to implement it so that it will set the controllers at runtime properly.

msub2 commented 3 years ago

Getting 2 errors currently after setting controller style in GetDeviceProfile:

NullReferenceException: Object reference not set to an instance of an object.
  at UnityEngine.Component.get_transform () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.BaseControllerBehavior.SetGeometry (TiltBrush.ControllerGeometry geom) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.BaseControllerBehavior.InstantiateControllerGeometryFromPrefab (TiltBrush.ControllerGeometry prefab) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.BaseControllerBehavior.get_ControllerGeometry () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.ControllerInfo.get_Geometry () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.InputManager.GetControllerGeometry (TiltBrush.InputManager+ControllerName eName) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.SketchControlsScript.AssignControllerMaterials (TiltBrush.InputManager+ControllerName controller) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.BaseControllerBehavior.Update () [0x00000] in <00000000000000000000000000000000>:0 

(Filename: currently not available on il2cpp Line: -1)

7114ce9f29-d85f-47f4-bb35-319d54b450fb:4182 NullReferenceException: Object reference not set to an instance of an object.
  at TiltBrush.SketchControlsScript.UpdateCurrentGazeRay () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.SketchControlsScript.UpdateControls () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.App.Update () [0x00000] in <00000000000000000000000000000000>:0 

(Filename: currently not available on il2cpp Line: -1)
msub2 commented 3 years ago

Running into a lot of issues figuring out exactly where to SetControllerStyle once the profile gets loaded. Going to try holding off on the Main scene async load until we've grabbed the profile, then load in and use GetDeviceProfile to feed in all the necessary headset info

msub2 commented 3 years ago

At work, currently unable to tell if WebXR Emulator is what's causing issues to be raised by the GPU Intersector. Remember to reimplement controller hold and test once home.

msub2 commented 3 years ago

It looks like it's finally working. The loading scene will hold off on loading the main scene until the input profile is located, making it easy to swap out the locations where I was forcing WMR with the proper controllers now. In order to do this though, I had to change SelectionWidget so that it's activation score will always return 1 so that GPU intersector doesn't throw errors.