Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlays in world space are in wrong position when going from Standing to Seated Tracking Space #830

Open
fragmentvr-dev opened this issue Jul 16, 2018 · 6 comments

Comments

@fragmentvr-dev
Copy link

If I create an overlay in Unity3D not set to track a device (so just positioned in the world at arbitrary coordinates) and the universe is set to standing, when I open a VR app that uses seated tracking universe while my app is still running the overlay changes position. Also, recreating the overlay while this second app is open still places it at the incorrect location. If the second app I open is instead a standing universe app this behavior is not observed.

@kisak-valve
Copy link
Member

Most likely a duplicate of #790.

@fragmentvr-dev
Copy link
Author

I guess it's the same issue, but there's no way to apply that fix to my case. My case is that an overlay gets placed in Unity's world space. Then the switch from Standing to Seated occurs moving the Tracking Universe's Origin to the Seated Zero Pose, but not affecting the Unity's coordinate system. From then on, even if I create a new overlay the position remains incorrect as the coordinate systems aren't aligned anymore. This is what I tried in the script that that creates and places a new overlay:

GameObject overlay = new GameObject();
/* add Overlay component to gameobject and what not */
/* overlay.transform.pos = arbitrary location*/
if(OpenVR.Compositor.GetTrackingSpace() == ETrackingUniverseOrigin.TrackingUniverseSeated) {
    SteamVR_Utils.RigidTransform overlayRT = new SteamVR_Utils.RigidTransform(overlay.transform);
    SteamVR_Utils.RigidTransform seated2StandingRT = new SteamVR_Utils.RigidTransform(OpenVR.System.GetSeatedZeroPoseToStandingAbsoluteTrackingPose()); 
    seated2StandingRT.Inverse();
    overlay.transform.position = (overlayRT * seated2StandingRT).pos;
}

using the RigidTransform struct found in SteamVR_Utils.cs of the SteamVR Unity3D plugin.

But it's not giving the intended output, still just giving wonky positions to the overlays.

@fragmentvr-dev
Copy link
Author

Has anyone had this kind of problem before?
My specific case is that I have an application initialized as "VRApplication_Overlay" that is meant to be used on top of other VR applications. So if I start my application first, and say that it is set as having a Standing tracking universe, and then open another application that has a Seated tracking universe, the overlays from my application teleport away, either way below my feet or way above my head.

@natbro
Copy link
Contributor

natbro commented Feb 1, 2019

different issue than #790, this shouldn't be happening since your overlay specifies its tracking origin.

@CurtisVL
Copy link

CurtisVL commented Jul 2, 2019

I'm still having a similar issue to this.
In my case, I'm trying to transfer an overlay that was created in standing space to seated space when the user opens an application that's using seated play.
Using the above code from @fragmentvr-dev the rotation is correct after switching to seated, but the position is not.
Any thoughts?

@fragmentvr-dev
Copy link
Author

Yeah that was my case too. I think I ended up saving the position of the overlay relative to the head each frame and when a universe change was detected I would use the last saved position to reposition the overlay in the world (using Transform.TransformPoint and the likes in case you aren't familiar with these sort of things). There were some issues with the asynchronous nature of the OpenVR callbacks though, so I had to set up more than one buffer and use values that were saved more than one frame ago to be sure to avoid spurious values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants