Following is my case
- I have a rectangle with
left=0,right=1824,top=0,bottom=989
with aspect ratio 1.84f, with uniformz axis = -3f
- In that rectangle, I have small rectangles with width and height of 344 and 182. I arrange those small rectangles in the 3 rows and 3 columns similar to a grid gallery.
- I did some modification in the orthographic projection without changing the z axis such that the new rectangle will be in range
-1,84 to 1.84 in x axis
and1 to -1 in y axis
and all the small rectangles lie in those range Then to render those rectangles on VR, I simply applied
view = perspective ( z near 0.1f, far 100 f) * eye.getEyeVew model = Orthographic transformation to come in range ( -1.84f to 1.84 f : X , 1 to 1f :Y ) modelview = view * model
To emulate the controller, I used a simple circle with
( centerX=0, centerY=0, radius =0.04f, zaxis = -3f)
Applied following transformation to the circle with controller rotation matrix (https://developers.google.com/vr/reference/android/com/google/vr/sdk/controller/Orientation.html#toRotationMatrix(float[]))
view = perspective ( z near 0.1f, far 100 f) * eye.getEyeVew controllerMatrix = controller.toRotationMatrix modelView = view * controllerMatrix
My assumption was following,
- Since, I was drawing the 3D planes with uniform Z values, I can consider them as a 2D plane for selection.
- I assumed that the circle 2D coordinate ( left,top,right,bottom) can be used to check with the plane 2D coordinate ( left,top,right,bottom) and see whether the circle falls in the the plane or not.
- But due to the perspective & eye.getEyeView transformation, the z axis of both the circle and plane changes.
So, my question is for this purpose should I go for RayCasting or there is a simple solution for selecting the small rectangles with VR controller.
I am using GVR controller ( Google VR version 1.80.0 )
and using Android for app development.
Thank you