Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feature Request OpenXR API Reference and Unity OpenXR

Discussion in 'VR' started by Kajta, May 31, 2022.

  1. Kajta

    Kajta

    Joined:
    Feb 13, 2016
    Posts:
    11
    I was looking for a way to load controller models via OpenXR, and came across the following API call in the OpenXR API reference page: xrLoadControllerModelMSFT where the runtime attempts to return a model for the currently connected controller devices, supplied through a key also retrieved with an API call.

    I tried to call this via DLLImport, but I couldn't be found, so I checked the UnityOpenXR.DLL file with the dumpbin tool and noticed it did not have a call exposed for: xrLoadControllerModelMSFT, and most of the OpenXR API calls are missing.
    I checked Microsofts implementation of the OpenXR API thats in the MRTK toolkit, and I saw they exposed their own version of this method in their OpenXR runtime.

    Are there any plans to expose more of the native OpenXR calls, or is there another way I can access some of the functions like xrLoadControllerModelMSFT without creating my own native library for OpenXR?

    Also, does Unity not support OpenXR completely yet, or why does Unity not expose the OpenXR features/calls from the OpenXR API reference?
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,973
    I cannot answer the technical questions, but you can check which controllers are used in script via XR Management and then change the model yourself
     
  3. Zenorbi

    Zenorbi

    Joined:
    Oct 1, 2019
    Posts:
    3
    OpenXR works like OpenGL in the sense that you don't have native functions floating around but you use xrGetInstanceProcAddr to get the function pointer. The xrGetInstanceProcAddr is available from
    OpenXRFeature.xrGetInstanceProcAddr

    I cannot really provide more details as I haven't needed this so far, just thought this might nudge you in the right direction.
     
    EricJohnsonVectrona likes this.