Open Nate27624 opened 2 months ago
I have the same issue. Have you figured out how to fix it?
I have the same issue. Have you figured out how to fix it?
Yes, sort of... I have it working now for my intended use case, but I don't understand what is different. Here is my code:
point = new Vector2(0.13f, 0.15f);
resultText.text = point.ToString();
float res = da.RaycastViewSpaceBlocking(point);
text.text = res.ToString();
cube.transform.localPosition = new Vector3(0, 0, res);
*make sure to attach the cube GameObject as a child of CenterEyeAnchor.
This script below helped me figure out though what was going on with these values and see which view space coordinates you need.
Vector2 leftThumbstick = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, OVRInput.Controller.LTouch);
Vector2 movement = Vector3.zero;
movement.x += scaler.x * leftThumbstick.x;
movement.y += scaler.y * leftThumbstick.y;
worldPoint += new Vector2(movement.x, movement.y);
Vector2 tmp = new Vector2(Mathf.Round(worldPoint.x * 100f) / 100f, Mathf.Round(worldPoint.y * 100f) / 100f);
resultText.text = tmp.ToString();
float res = da.RaycastViewSpaceBlocking(tmp);
text.text = res.ToString();
cube.transform.localPosition = new Vector3(0, 0, res);
I also did factory reset my headset (I was wondering if later updates to the headset changed the depth texture), but I do not think that was the reason why it worked. I hope this code at the very least can help you debug your code and try and come up with a solution!
I just downloaded and tested this project, but it seems like I am only able to get depth for the view space at 0,0. I think there is a quick fix available in the compute shader, but I am not familiar enough with the language to fix it myself.
To emulate the bug just download the project and set it up and try and ray cast the cubes. They will all be really close to your face because it is at a depth of 0.1 due to the error in the calculation somewhere.
Example:
float res = da.RaycastViewSpaceBlocking(new Vector2(1f, 1f));
The above line of code has res = 0.1 no matter what