Qt3d tank example: projection of click position
I played around with the qt3d tank example and found that when creating new tanks, they are not exactly placed at the position I double clicked. This is only true for the middle of the plane but not for the edges. At the edges there is a shift which depends on the distance to the middle of the plane. I could not find any obvious errors when looking at the code.
I've found the error.
The camera's upVector has not been updated (default: 0,1,0). When the camera's direction (eye-center) is not parallel to the plane (as it is in the example), then the initial upVector is no longer orthogonal to the camera direction. For a correct projection, however, it must be. So you have to calculate a new upVector in initializeGL, after having positioned the eye.