Editor Mouse Input w/ Vive

I’m trying to make a custom input module so I can click on stuff in the Editor Game Pane while my Vive project is running, but I’m running into issues translating the mouse position in the pane into a world position.

Has anyone else worked on this?

Fake PS - I’ll post up more later, since the act of trying to describe the problem is helping to (maybe) solve it, but I might as well see if anyone can give help sooner rather than later.

Update:
Yeah, so, from what I HAD written up to explain the problem, I’ve now learned: Predictably, the Viewport is what’s seen in the VR rig, not what’s in the editor pane, while the mousePosition in pane coordinates. So now I just need to figure out the mapping from the pane to the viewport…?

Update: Yep. Rubber-duck-debugging strikes again. Here’s the code snippets that make it all work, I think:

public static Vector2 GetMainGameViewSize() {
        System.Type T = System.Type.GetType("UnityEditor.GameView,UnityEditor");
        System.Reflection.MethodInfo GetSizeOfMainGameView = T.GetMethod("GetSizeOfMainGameView", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
        System.Object Res = GetSizeOfMainGameView.Invoke(null, null);
        return (Vector2)Res;
}

public Vector3 worldPoint() {
        Vector3 viewportPoint = Vector3.one;
        viewportPoint.x = Input.mousePosition.x / GetMainGameViewSize().x;
        viewportPoint.y = Input.mousePosition.y / GetMainGameViewSize().y;

        Camera.main.ViewportToWorldPoint(viewportPoint)
}

I do need to wire it up the event system raycasting to be sure, but, it’s promising. Very promising.

Nope, but it’s progress. The veiwport to game pane isn’t as simple as that, apparently.

So that’s the new question: What’s the relationship between what’s shown on the veiwport, and what’s shown in the Editor pane?

Okay, determined that the game pane is a subset of the actual screen, and it’s a straight interpolation. I experimentally determined good values for the interpolation buuuuut a) it only works if your aspect ratio is set 2:1 and b) it would be great to know what’s ACTUALLY going on, to get real numbers and all that.

So this is “working”, but in a hacktastic way.