Open fragmentvr-dev opened 6 years ago
Most likely a duplicate of #790.
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.
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.
different issue than #790, this shouldn't be happening since your overlay specifies its tracking origin.
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?
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.
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.