Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question [OpenXR] How to check for position/rotation/velocity at time T instead of just "now" ?

Discussion in 'VR' started by SPollari, Dec 20, 2021.

  1. SPollari


    Sep 8, 2021
    I've been learning the OpenXR API in Unity and I can't figure this out.

    Khronos documentation on OpenXR states that you can ask the runtime for Pose data with a timestamp.

    Is this feature available in Unity?

    In Unity you can query the controllers for their position, rotation, velocity etc. during runtime, but can you specify at what time you wish to look at?
  2. colinleet


    Nov 20, 2019
    XR positions are updated every frame, I have absolutely no idea why you would want to manually override that when that information is automatically retrieved from OpenXR, and legacy plugins, for you. It's a bad idea to muck with, if it's even possible. Unity uses the XR position update like a VSYNC, and delays running the next frame till it's ready with new data. This guarantees you to have a fresh location every frame. Mucking with that would break your steady framerate.

    If you want a previous location for controllers/headset -- you would have to manually record those previous transform pos/rots. The best data structure to use would be a circular buffer the length of the number of frames you want to keep around, as it's non-ram-allocating after initiation: