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

SteamVR_PlayArea calculates vertices at different corners depending on Calibrated or specific size #25

Closed
thestonefox opened this issue Mar 27, 2017 · 2 comments

Comments

@thestonefox
Copy link

If the SteamVR_PlayAre is set to Size = Calibrated then the vertices in the public vertices variable are reported as follows:

vertices[0] = Bottom Right Inner point
vertices[1] = Bottom Left Inner point
vertices[2] = Top Left Inner point
vertices[3] = Top Right Inner point

vertices[4] = Bottom Right Outer point
vertices[5] = Bottom Left Outer point
vertices[6] = Top Left Outer point
vertices[7] = Top Right Outer point

If the Size is set to any other specific size (e.g. 200x150) then the vertices Vector3 array reports the corners in different locations:

vertices[0] = Top Right Inner point
vertices[1] = Bottom Right Inner point
vertices[2] = Bottom Left Inner point
vertices[3] = Top Left Inner point

vertices[4] = Top Right Outer point
vertices[5] = Bottom Right Outer point
vertices[6] = Bottom Left Outer point
vertices[7] = Top Left Outer point

This causes issues if these vertices are being used to draw a Play area representation as the figures are not consistent.

The piece of code that dictates the manual Quad for the play area is located here:
https://github.com/ValveSoftware/steamvr_unity_plugin/blob/master/Assets/SteamVR/Scripts/SteamVR_PlayArea.cs#L66-L80

However, to have it consistent with how the Calibrated play area is set up it should be:

pRect.vCorners0.v0 =  x;
pRect.vCorners0.v1 =  0;
pRect.vCorners0.v2 =  -z;

pRect.vCorners1.v0 =  -x;
pRect.vCorners1.v1 =  0;
pRect.vCorners1.v2 = -z;

pRect.vCorners2.v0 = -x;
pRect.vCorners2.v1 =  0;
pRect.vCorners2.v2 = z;

pRect.vCorners3.v0 = x;
pRect.vCorners3.v1 =  0;
pRect.vCorners3.v2 =  z;

Example of the discrepancy in an image:
image

I'll also raise a PR to go with this ticket.

@thestonefox
Copy link
Author

PR with fix #26

thestonefox added a commit to ExtendRealityLtd/VRTK that referenced this issue May 11, 2017
If the SteamVR PlayArea `Draw In Game` option is unchecked then the
play area mesh is not generated which means anything relying on the
vertices from the mesh will not work (such as the play area cursor).

This fix ensures the `BuildMesh` method is called in the boundary
init function so it is always called at least once at runtime.

The second issue came from when the play area size was set to a
specific size other than calibrated. It seems that SteamVR puts
the vertices into a different order when using non-calibrated sizes
as can be seen in this issue on the SteamVR Github page:

ValveSoftware/steamvr_unity_plugin#25

This has been fixed within VRTK by flipping the vertices accordingly
so they are in the correct position. In the future, if Valve fix this
within SteamVR then this can be wrapped in a script define so it only
affects older versions of SteamVR.
@aleiby
Copy link
Contributor

aleiby commented Jun 15, 2017

Thanks, I'll integrate this for the next update.

@aleiby aleiby closed this as completed Jun 15, 2017
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

2 participants